0% found this document useful (0 votes)
26 views1 page

"Enter An Alphabet:" "%C": Int Char Int Char

The document contains a C program that takes a character as input from the user and checks if it is a vowel, consonant, or invalid character. It defines a function checkAlphabet() that returns 1 if the character is an alphabet, or 0 otherwise. Based on the return value, it uses a switch statement to print whether the character is a vowel, consonant, or 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)
26 views1 page

"Enter An Alphabet:" "%C": Int Char Int Char

The document contains a C program that takes a character as input from the user and checks if it is a vowel, consonant, or invalid character. It defines a function checkAlphabet() that returns 1 if the character is an alphabet, or 0 otherwise. Based on the return value, it uses a switch statement to print whether the character is a vowel, consonant, or 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/ 1

1

2
3 /**Name : Mohammad Riazul Islam
4 Roll : 1906
5 ---------------------------------**/
6
7 #include<stdio.h>
8 int checkAlphabet(char ch);
9 int main()
10 {
11 char ch;
12 printf("Enter an Alphabet :");
13 scanf("%c",&ch);
14 int check=checkAlphabet(ch);
15 switch(check)
16 {
17 case 1:
18 switch(ch)
19 {
20 case 'a' :
21 case 'e' :
22 case 'i' :
23 case 'o' :
24 case 'u' :
25 case 'A' :
26 case 'E' :
27 case 'I' :
28 case 'O' :
29 case 'U' :
30 printf("\n%c is a vowel\n",ch);
31 break;
32 default:
33 printf("\n%c is a consonant\n",ch);
34 }
35 break;
36 default :
37 printf("\nInvalid....%c is not an alphabet\n",ch);
38 }
39 return 0;
40 }
41
42 int checkAlphabet(char ch)
43 {
44 if((ch>='a' && ch<='z') || (ch>='A' && ch<='Z'))
45 {
46 return 1;
47 }
48 else
49 {
50 return 0;
51 }
52 }

You might also like