Write a program that checks whether a character entered by the user is a vowel or not (using switch case)
C Programming Language Decision Making of C Language (Article) Decision Making of C Language (Program)
1046Program:
#include int main(void) { char c; printf("Enter a character: "); scanf("%c", &c); switch(c) { case 'a': case 'A': case 'e': case 'E': case 'i': case 'I': case 'o': case 'O': case 'u': case 'U': printf("%c is always a vowel!\n", c); break; case 'y': case 'Y': printf("%c is sometimes a vowel!\n", c); break; default: printf("%c is not a vowel!\n", c); } getch(); return 0; }
Output:
Output 1: Enter a character: a a is always a vowel! Output 2: Enter a character: C C is not a vowel!
Explanation:
None
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.