Create a program that will accept a stream of characters that will display vowels and consonants.
Wed May 08 2024 04:37:28 GMT+0000 (Coordinated Universal Time)
Saved by
@JC
#include <stdio.h>
#include <ctype.h>
int main() {
char c;
int vowels=0, consonant=0;
puts("Enter a stream of characters:");
while((c=getchar())!='\n')
{
if(isalpha(c))
{
if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='A'||c=='E'||c=='I'||c=='O'||c=='U')
vowels++;
else
consonant++;
}
}
printf("Vowels: %d\n", vowels);
printf("Consonant: %d", consonant);
return 0;
}
content_copyCOPY
Comments