Hello Friends! Welcome to programming shortcut
Today will discuss:
--> Program to find whether the alphabet is a vowel or consonant or
--> c program to check vowel or consonant using a switch or
--> program to check an alphabet is a vowel or consonant
Today will discuss:
--> Program to find whether the alphabet is a vowel or consonant or
--> c program to check vowel or consonant using a switch or
--> program to check an alphabet is a vowel or consonant
#include
#include
void main()
{
char ch;
printf("Enter an alphabet : \n");
scanf("%c",&ch);
switch(ch)
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
printf("Alphabet is a vowel\n");
break;
default:
printf("Alphabet is a consonant\n");
}
getch();
}
#include
void main()
{
char ch;
printf("Enter an alphabet : \n");
scanf("%c",&ch);
switch(ch)
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
printf("Alphabet is a vowel\n");
break;
default:
printf("Alphabet is a consonant\n");
}
getch();
}
Output:
First, run:
Enter the alphabet :
a
Alphabet is a vowel
Second Time run:
Enter the alphabet :
d
Alphabet is a consonant
First, run:
Enter the alphabet :
a
Alphabet is a vowel
Second Time run:
Enter the alphabet :
d
Alphabet is a consonant
Explanation: In this programming, we use the Switch case to check an alphabet is a vowel or consonant
Hello, Friend We first write the program and compile them and run the program to check compiler error or run time error.
Please share the site and comment on your ideas and your suggestions. All suggestion was all welcome.
If any question or doubt in the programming please mention the comment.
Thank yours very much.