C Program to count the number of vowels in given string ,
C Program accept the character and find the occurrence in given string and count frequency,
C Program to count the number of vowels in given string
#include
#include
int vowel (int len);
charstr[50];
{
int ans1, ans2, len;
clrscr ();
printf ("Enter your string: ");
gets (str);
len = strlen (str);
ans1 = vowel (len);
printf ("Total vowels are: %d", ans1);
getch ();
return (0);
}
int vowel (int len)
{
int count;
if (len == 1)
return count;
else if (str[len-1] == 'A' || str[len-1] == 'a' || str[len-1] ==
'E' || str[len-1] == 'e' || str[len-1] == 'I' || str[len-1] == 'i' ||
str[len-1] == 'O' || str[len-1] == 'o' || str[len-1] == 'U' || str[len-1] ==
'u')
{
count++;
}
else
{
vowel (len-1);
}
}