#include <stdio.h> #include <ctype.h> int main() { char c; int a=0, e=0, i=0, o=0, u=0; puts("Enter a stream of characters:"); while((c=getchar())!='\n') { switch(c) { case 'a': case 'A':a++; break; case'e': case'E':e++; break; case 'i': case 'I':i++; break; case 'o': case 'O':o++; break; case 'u': case 'U':u++; break; } } printf("A=%d\n", a); printf("E=%d\n", e); printf("I=%d\n", i); printf("O=%d\n", o); printf("U=%d\n", u); 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