#include <stdio.h> #include <ctype.h> int main() { char c; int vowels=0, consonant=0; puts("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; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter