C Program to Check Whether a Character is Consonant or not

#include<stdio.h>
#include<conio.h>

int main()
{
	 char ch;
	 clrscr();
	 printf("Enter any character: ");
	 scanf("%c", &ch);
	
	 /* Converting to lowercase if it is uppercase  */
	 ch = ch>='A'&&ch<='Z'?ch+32:ch;
	 
	 /* Making Decision */
	 if(ch>='a'&&ch<='z')
	 {
	  if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
	  {
	   printf("It is NOT CONSONANT.");
	  }
	  else
	  {
	   printf("It is CONSONANT.");
	  }
	 }
	 else
	 {
	  printf("It is not CONSONANT.");
	 }
	 getch();
	 return(0);
}

Output

Run 1:
----------
Enter any character: a ↲
a is NOT CONSONANT.

Run 2:
----------
Enter any character: p ↲
p is CONSONANT.

Run 3:
----------
Enter any character: B ↲
B is CONSONANT.

Run 4:
----------
Enter any character: 9 ↲
9 is NOT CONSONANT.

Leave a Reply

Your email address will not be published. Required fields are marked *

https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
About
Products
Subscribe

If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

    Applauz

    As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

    Subscribe

    If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

      Applauz

      As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

      Copyright by BOLD THEMES. All rights reserved.