C Program switch case: "Check given character is Vowel or not using switch" with output
#include <stdio.h>
int main() { char ch; // Input character from the user printf("Enter a character: "); scanf(" %c", &ch); // Convert the character to lowercase to handle both upper and lower case vowels ch = tolower(ch); switch(ch) { case 'a': case 'e': case 'i': case 'o': case 'u': printf("%c is a vowel.\n", ch); break; default: printf("%c is not a vowel.\n", ch); } return 0; }Enter a character: A
A is a vowel.
Comments
Post a Comment