ccplusplus.com
Learn C, C++ Concepts
Thursday, September 22, 2011
c program to check number capital letter small letter symbol
/*********************************************************************** * File : check-user-entered-character.c * Author : Saurabh Gupta * Desc : C Program to identify user entered number,Capital Letter, * Small Letter or Symbol * Source : http://saurabhgupta0527.blogspot.com/p/c.html * Created : AM 10:27 22 September 2011 * Note : ************************************************************************/ #include<stdio.h> int main() { char cUserInput; printf ("Enter any character\n"); scanf ("%c", &cUserInput); if(cUserInput>=65 && cUserInput<=90) { printf ("You have entered : Capital Letter\n"); } else { if(cUserInput>=97 && cUserInput<=122) { printf ("You have entered : Small Letter\n"); } else { if(cUserInput>=48 && cUserInput<=57) { printf ("You have entered : digit\n"); } else { printf ("You have entered : symbol\n"); } } } return 0; } /* * OUTPUT * [sgupta@rhel55x86 c]$ gcc check-user-entered-character.c -o check-user-entered-character [sgupta@rhel55x86 c]$ ./check-user-entered-character Enter any character 12 You have entered : digit [sgupta@rhel55x86 c]$ ./check-user-entered-character Enter any character s You have entered : Small Letter [sgupta@rhel55x86 c]$ ./check-user-entered-character Enter any character S You have entered : Capital Letter [sgupta@rhel55x86 c]$ ./check-user-entered-character Enter any character ! You have entered : symbol [sgupta@rhel55x86 c]$ */
See also
Other popular tricky C Sample Codes and language Concept
.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment