Header Ads Widget

C program to input any alphabet and check whether it is vowel or consonant

 C program to input any alphabet and check whether it is vowel or consonant

Given a character , write a program to check whether it is vowel or consonant . Vowels are (a ,e ,i , o , u ) and (  A , E , I , O , U) and except these characters all are consonants .

Sample input

f

Sample output

f is consonant

 C program to input any alphabet and check whether it is vowel or consonant

The objective of the code is to check whether the character is vowel or consonants . 

Code(C):-

#include<stdio.h>
int main()
{
char ch;
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("%c is vowel",ch);
else
printf("%c is consonant",ch);
return 0;
}


Output:-


f
f is consonants

Recommended Post :-

HCL Coding Questions:-

Capgemini Coding Questions:-

Companies interview:-

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-