/* Program to count the number of vowels in a given string */ /* Problem 24 */ #include #include #include main() { char str[80]; int i,len,count; clrscr(); printf("Please enter a string : "); gets(str); count = 0; len = strlen(str); for (i = 0; i < len; i++) { if ((str[i] == 'a') || (str[i] == 'e') || (str[i] == 'i')) count++; else if ((str[i] == 'o') || (str[i] == 'u')) count++; } printf("\nEntered string contains %d vowels",count); printf("\n\nPress any key to exit..."); getch(); }