C Program to Check Whether a Character is Vowel or Consonant using Conditional operator

C Program to Check Whether a Character is Vowel or Consonant using Conditional operator

Write a C program to input a character and check whether the character is Vowel or Consonant using Conditional/Ternary operator ?:. How to check alphabets using conditional operator in C programming.

Required knowledge

Operators, Data Types in c, Variables in C

C Program to Check Whether a Character is Vowel or Consonant using conditional operator

/** * C Program to Check Whether a Character is Vowel or * Consonant alphabets using Conditional operator */ #include <stdio.h> #include <conio.h> void main() { char ch; clrscr(); printf("\n Enter any character:"); scanf("%c",&ch); (ch=='a'||ch=='A'||ch=='e'||ch=='E'||ch=='i'||ch=='I'||ch=='o'||ch=='O'||ch=='u'||ch=='U')? printf("\n %c is Vowel",ch):printf("\n %c is consonant",ch); getch(); }


Output:
Enter any character: a a is Vowel




Instagram