Create a program that will accept a stream of characters that will display the count of vowels.
Wed May 08 2024 04:38:20 GMT+0000 (Coordinated Universal Time)
Saved by
@JC
#include <stdio.h>
int main() {
char ch;
int vowelCount = 0;
printf("Enter a stream of characters:\n");
while ((ch = getchar()) != '\n') {
if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' ||
ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U') {
vowelCount++;
}
}
printf("Number of vowels: %d\n", vowelCount);
return 0;
}
content_copyCOPY
Comments