C Program to Input String and Count Vowel from the String

0
16
digitalample eye
Write a C program to input a string and count the no of vowels in the string.

Write a program to input string and count the vowel from the entered string. 
C Program to Input String and Count Vowel from the String

Source Code

#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
char string[25];
int count=0,i,length;
clrscr();
printf("Enter the string:");
scanf("%s",string);
length=strlen(string);
for(i=0;i<length;i++)
{
if(string[i]=='a'||string[i]=='e'||string[i]=='i'||string[i]=='o'||string[i]=='u')
count=count+1;
}
printf("No of vowels=%d",count);
getch();
}

LEAVE A REPLY

Please enter your comment!
Please enter your name here