ccplusplus.com
Learn C, C++ Concepts
Saturday, September 10, 2011
identify given character vowels or consonants in c
/****************************************************** * File : identify-given-character-vowels-and-consonants.c * Author : Saurabh Gupta * Source : http://saurabhgupta0527.blogspot.com/ * Created : PM 06:31 10 September 2011 * Note : determine whether the entered chracter * is consonant or vowel *****************************************************/ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include<ctype.h> int main(int argc, char **argv) { char cCharacter; printf("\n Enter any character:"); scanf("%c",&cCharacter); switch(tolower(cCharacter)) { case 'a': case 'e': case 'i': case 'o': case 'u': printf("\n The character is vowel!\n"); break; default : printf("\n The chracter is consonant!\n"); return 0; } } /* * OUTPUT * [sgupta@rhel54x64 c]$ gcc identify-given-character-vowels-and-consonants.c -o identify-given-character-vowels-and-consonants [sgupta@rhel54x64 c]$ ./identify-given-character-vowels-and-consonants Enter any character:d The chracter is consonant! [sgupta@rhel54x64 c]$ ./identify-given-character-vowels-and-consonants Enter any character:a The character is vowel! [sgupta@rhel54x64 c]$ */
See Also
Various other Popular C codes and C topics
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment