Q.) W.A.P to check an alphabet is vowel or not in C using if else ?
#include<stdio.h>
#include<conio.h>
int main()
{
char c;
printf("Enter an alphabet: ");
scanf("%c",&c);
if(c=='a'||c=='A'||c=='e'||c=='E'||c=='i'||c=='I'||c=='o'||c=='O'||c=='u'||c=='U'){
printf("%c is a vowel.",c);
}
else{
printf("%c is a consonant.",c);
}
getch();
}
Output
Enter an alphabet :
b /* say c = b */
b is a consonant.