My Subject Blog

C Program to Find Vowels in String

/*
Write a program to Count no. of Vowels in given String. 
*/

#include <stdio.h>

int main(void) {
// your code goes here
char str[100];
int i,cnt=0;
printf("Enter the String : ");
scanf("%[^\n]s",str);
for(i=0;str[i]!='\0';i++)
{
switch(str[i])
{
case 'A':
case 'a':
case 'E':
case 'e':
case 'I':
case 'i':
case 'O':
case 'o':
case 'U':
case 'u':
cnt++;
break;
}
}
printf("Total No of Vowel : %d",cnt);
return 0;
}

Comments

Most Visited Post

C Program to Find Largest Odd Number from Array

Followers