Program to cheque give character is vowel or not using switch case in C-language

                         Method-1

#include<stdio.h>
int main()
{
    char ch;
    printf("Enter the character\n");
    scanf("%c",&ch);
    switch(ch)
    {
        case'a':
        printf("Enter character is vowel");
        break;
        case'e':
        printf("Enter character is vowel");
        break;
        case'i':
        printf("Enter character is vowel");
        break;
        case'o':
        printf("Enter character is vowel");
        break;
        case'u':
        printf("Enter character is vowel");
        break;
        case'A':
        printf("Enter character is vowel");
        break;
        case'E':
        printf("Enter character is vowel");
        break;
        case'I':
        printf("Enter character is vowel");
        break;
        case'O':
        printf("Enter character is vowel");
        break;
        case'U':
        printf("Enter character is vowel");
        break;
        default:
        printf("Enter character is not vowel");
    }
}
                           Method-2
#include<stdio.h>
int main()
{
    char ch;
    printf("Enter the character\n");
    scanf("%c",&ch);
    switch(ch)
    {
        case'a':
        case'e':
        case'i':
        case'o':
        case'u':
        case'A':
        case'E':
        case'I':
        case'O':
        case'U':
        printf("Enter character is vowel");
        break;
        default:
        printf("Enter character is not vowel");
    }
}

OUTPUT
Enter the character
e
Enter character is vowel

Comments

Popular posts

Creative pattern of butterfly in C-language

Program to show present time and date in C-language

Introduction of C-language.

Program to cheque enter number is a perfect number or not using if else in C-language

Program to cheque four digits number is palindrome or not in C-language

Program to print the cube of a number in c-language

Simple Hello world program in c- language