Sunday, September 16, 2018

22. WAP to check whether an alphabet is a vowel or consonant or not.

#include<stdio.h>
#include<conio.h>
void main()
{
   char ch;
   printf("Enter the character: ");
   scanf("%c",&ch);
   if(ch=='A' || ch=='E' || ch=='I' || ch=='O' || ch=='U'
    || ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u')
      printf("\n'%c' is a Vowel.",ch);
   else if( (ch>='a' && ch<='z') || (ch>='A' && ch<='Z') )
      printf("\n'%c' is a Consonant.",ch);
   else
      printf("\n'%c' is not an alphabet.",ch);
   getch();
}


Output:




Please have a look at the below lesson posted on my YouTube channel:


No comments:

Post a Comment