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
1097Program:
#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.
# C Tutorials
# JAVA Tutorials
# HTML Tutorials
# Computer Fundamental
# Data Structure
# DBMS Tutorials
SQL
# C# Language
# R Language
# PHP
# Python
# Vue JS