C program to count number of vowels in a string

 

#include <stdio.h>
int main()
{

char str[100];
int count=0,i=0;
printf("enter string");
gets(str);

for(i=0; str[i]!='\0'; ++i){
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'){
count++;
}

}
printf("number of vowels in that string are %d",count);
return 0;
}



 

Output