Coding Practice

Write a C program to input any alphabet and check whether it is vowel or consonant

Check vowel or consonant
Sample Output
Enter a alphabet: A

A is vowel.

Process returned 0 (0x0)   execution time : 9.627 s
Press any key to continue.
Source Code
#include<stdio.h>
int main()
{
char ch;
printf("Enter a alphabet: ");
scanf("%c", &ch);
if(ch == 'a' || ch == 'e' || ch == 'i' ||ch == 'o' || ch == 'u' ||
ch == 'A' || ch == 'E' || ch == 'I' ||ch == 'O' || ch == 'U')
{
printf("\n%c is vowel.\n", ch);
}
else
{
printf("\n%c is consonant.\n", ch);
}
return 0;
}
Sample Output
Enter a alphabet: y

y is consonant.

Process returned 0 (0x0)   execution time : 1.547 s
Press any key to continue.

No comments:

Post a Comment

Change Theme
X