#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; }
No comments:
Post a Comment