c program to print vowels or consonants using if-else

C program to print vowels or consonants using if-else. Check the vowel or consonant in C program. 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

#include <stdio.h>
int main() 
{
char c;
int small, big;
printf("Enter the letter");
scanf("%c", &c);
small = (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
big = (c == 'A' || c == 'E' || c == 'I' || 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

What is 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.

What is consonant in c program

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.

What is if and else statement in c program

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.