c program to check an alphabet is vowel or consonant

c program to check an alphabet is vowel or consonant 

Enter any alphabet then it will give an alphabet is vowel or consonant.vowel are a,e,i,o,u.and rest all the alphabets are consonant. 



#include <stdio.h>
int main()
{
    char c;
    int isLowercaseVowel, isUppercaseVowel;

    printf("Enter an alphabet: ");
    scanf("%c",&c);

    // evaluates to 1 (true) if c is a lowercase vowel
    isLowercaseVowel = (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');

    // evaluates to 1 (true) if c is an uppercase vowel
    isUppercaseVowel = (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U');

    // evaluates to 1 (true) if either isLowercaseVowel or isUppercaseVowel is true
    if (isLowercaseVowel || isUppercaseVowel)
        printf("%c is a vowel.", c);
    else
        printf("%c is a consonant.", c);
    return 0;
}
c program to check an alphabet is vowel or consonant


Comments

Popular posts from this blog

c program to convert any three digit number in words

c program to remove characters in string except alphabets