Check vowel using switch statement - Devbhoomi

FREE JOB ALERT & ONLINE TUTORIALS

Hot

Post Top Ad

Monday 6 November 2017

Check vowel using switch statement

#include <stdio.h>

int main()
{
    char ch;

    printf("Input a character : ");
    scanf("%c", &ch);

    switch (ch)
    {
        case 'a':
        case 'A':
        case 'e':
        case 'E':
        case 'i':
        case 'I':
        case 'o':
        case 'O':
        case 'u':
        case 'U':
            printf("%c is a vowel.\n", ch);
            break;
        default:
            printf("%c is not a vowel.\n", ch);
    }

    return 0;
}
OUTPUT
Input a character : u
u is a vowel.

No comments:

Post a Comment

Post Top Ad