Home » C Programs » C Program to Check Vowel or Consonant

C Program to Check Vowel or Consonant

This program will help you to find the letter is vowel or consonant in c programming language. This program will check whether the letter is vowel letter like a,e,i,o,e

Vowel in C Program

A return statement marks the end of a function’s execution and hands control back to the calling function. The calling function continues execution at the place where the call was made. A return statement can give the calling function a value.

Consonant in C

A consonant is a sound that is not a vowel in speech. It also refers to the letters of the alphabet that represent certain sounds: consonants include Z, B, T, G, and H. All non-vowel sounds, or their equivalent letters, are consonants: A, E, I, O, U, and occasionally Y are not consonants. H and T are consonants in hat.

If Else Statement in C

In C, the if-else statement is used to carry out actions based on a set of conditions. If and only if the provided condition is true, the actions indicated in the if block are executed. Here we have executed the c program to check vowel or consonant for beginners.

C Program to Check Vowel or Consonant

//c program to check vowel or consonant
#include <stdio.h>
int main() 
{
char c;
int small, big;
printf("Enter the letter");
scanf("%c", &c);
small = (c == 'a' || c == 'e' || c == 'o' || c == 'u');
big = (c == 'A' || c == 'E'  || c == 'O' || c == 'U');
if (small || big)
printf("%c is a vowel", c);
else
printf("%c is a consonant", c);
return 0;
}

Output 

Enter the letter

g

g is a consonant