#include <stdio.h> #include <ctype.h> int counta, counte, counti, counto, countu, countvowel, countconsonant; int main() { char c; printf("Input A string of characters: "); while ((c=getchar()) != '\n') if (c == 'a' || c == 'A' || c == 'e' || c == 'E' || c == 'i' || c == 'I' || c == 'o' || c == 'O' || c == 'u' || c == 'U') { countvowel++; } else countconsonant++; printf("vowels = %d \n", countvowel); printf("consonants = %d \n", countconsonant); 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