Tuesday 10 January 2012

Check vowel using switch statement

#include<stdio.h>
#include<conio.h>
void main()
{
    char ch;
    clrscr();
    printf("Enter a character\n");
    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);
    }
    getch();
}


Output:
check charater case output

No comments:

Post a Comment