C program to input any string and count total number of vowel.
#include<stdio.h>
#include<conio.h>
void main( )
{
char str[20]; int i, c=0;
clrscr( );
printf("enter any string ");
scanf("%s",str);
i=0;
while(str[i]!='\0')
{
if(str[i]=='A' || str[i]=='a' || str[i]=='E' || str[i]=='e' || str[i]=='I' || str[i]=='i' || str[i]=='O' || str[i]=='o' || str[i]=='U' || str[i]=='u' )
{
c=c+1;
}
i=i+1;
}
printf("Total Vowel is %d\n",c);
getch( );
}
0 Comments