C Program - Check vowel



#include <stdio.h>
#include <conio.h>

int main()
{
    char ch;

    printf("Input 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;
    /*if ch matches any case then it prints & breaks the execution */
    default:
        printf("%c is not a vowel.\n", ch);
        /*if the ch is not from the cases then prints ch is not a vowel */
    }

    getch();
    return 0;
}

Output
----------

Comments

Popular posts from this blog

Introduction to C++ Programming Language

The Assembly Process Of 8086 Microprocessor-Two Pass Assembling Steps

Installing 8086 Assembler on a Computer