Friday, August 16, 2019

WAP to check whether the entered character is vowel or not using switch case statement.

// C program

#include<stdio.h>
void main()
{
     char ch;
     clrscr();
     printf("Enter any character:");
     scanf("%c",&ch);
     switch(ch)
     {
          case 'a' || 'A':
          case 'e' || 'E':
          case 'i' || 'I':
          case 'o' || 'O':
          case 'u' || 'U':
                                printf("The character is a vowel");
                                break;
          default: printf("The character is not vowel");
                       break;
      }
      getch();
}

Sample Input/Output:

Enter any character: A
The character is a vowel

No comments:

Post a Comment

Write a program to find gcd of two numbers using recursion.

About:  The process in which a function calls itself is called recursion and the corresponding function is called as recursive function. ...