Program to check vowel and consonant

Source Code

// 10. Program to check vowel and consonant
// Arpan Das - CST 2nd Year (VOCLET)

#include <stdio.h>
//#include <conio.h>
//#include <stdlib.h>

void main () {
	int i, flag=0;
	char vowels[10] = {'A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u'};
	char letter;
	//clrscr();
	//system("cls");

	printf("\t\t..:: check vowel and consonant ::..\n\n");
	printf("Enter any alphabet: ");
	scanf("%c", &letter);

	for (i=0; i<10; i++) {
		if (letter == vowels[i]) {
			flag = 1;
			break;
		}
	}

	if (flag == 1) printf("\n\"%c\" is vowel!", letter);
	else printf("\n\"%c\" is consonant!", letter);

	//getch();
}

Output

		..:: check vowel and consonant ::..

Enter any alphabet: B

"B" is consonant!

Enter any alphabet: E

"E" is vowel!

Leave a Reply

Note: Your email address will not be published. Required fields are marked *