#include <stdio.h>
int main()
{
char str[80];
int i, count= 0;
printf("Enter a string: ");
gets(str);
for (i = 0; str[i] != '\0'; i++)
{
/* Checking for vowels */
if (str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u')
{
count++;
}
}
printf("The number of vowels = %d", count);
return 0;
}
Saturday, 15 July 2017
Write a C program to count the number of vowels in a given string and display all the vowels in it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment