0% found this document useful (0 votes)
41 views5 pages

Assignment: Detecting Vowel & Consonant by Using Switch

This C program uses a switch statement to detect whether an input character is a vowel or consonant. The user enters a character which is checked in the switch against cases for each vowel and printed as a vowel. Alternatively it is checked against cases for each consonant and printed as a consonant. Any other character prints as invalid.

Uploaded by

Tonmoy Aman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views5 pages

Assignment: Detecting Vowel & Consonant by Using Switch

This C program uses a switch statement to detect whether an input character is a vowel or consonant. The user enters a character which is checked in the switch against cases for each vowel and printed as a vowel. Alternatively it is checked against cases for each consonant and printed as a consonant. Any other character prints as invalid.

Uploaded by

Tonmoy Aman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Assignment

On
Detecting Vowel & Consonant By Using Switch

Submitted To Submitted By
Dr.Md.Mahbubul Alam Joarder Mohammad Mostafizur Rahman
Professor Class Roll - 1936
Institute of Information Technology PGDIT Batch - 19
University of Dhaka University of Dhaka

Submission Date: 11/02/2019


//Switch statement : switch, case, break, default
#include<stdio.h>
int main ()
{
char ch;
printf("Enter any 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("It is vowel\n");
break;
case 'b':
case 'B':
case 'c':
case 'C':
case 'd':
case 'D':
case 'f':
case 'F':
case 'g':
case 'G':
case 'h':
case 'H':
case 'j':
case 'J':
case 'k':
case 'K':
case 'l':
case 'L':
case 'm':
case 'M':
case 'n':
case 'N':
case 'p':
case 'P':
case 'q':
case 'Q':
case 'r':
case 'R':
case 's':
case 'S':
case 't':
case 'T':
case 'v':
case 'V':
case 'w':
case 'W':
case 'x':
case 'X':
case 'y':
case 'Y':
case 'z':
case 'Z':
printf("It is consonant\n");
break;
default:
printf("It is invalid character\n");

}
return 0;
}

You might also like