Skip to main content

Whether a character is Vowel or Consonant

#include <stdio.h>
int main()
{
    char ch;
    printf("Enter an alphabet\t:\t");
    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("\n'%c' is a vowel", ch);
    else
        printf("\n'%c' is a consonant", ch);
    return 0;
}

Enter an alphabet :  U

'U' is a vowel 

Comments