sahajjain01

E1.Input a char & check if its uppercase,lowercase or digit.

Sep 2nd, 2015
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. //Program to input a character and check if it's upper case, lower case or a digit.
  2. #include<stdio.h>
  3. #include<conio.h>
  4. #include<ctype.h>
  5.  
  6. void main()
  7. {
  8.     char ch;
  9.  
  10.     clrscr();
  11.  
  12.     printf("Enter a character: ");
  13.     scanf("%c", &ch);
  14.  
  15.     if(isupper(ch))
  16.         printf("The character %c is upper case.", ch);
  17.     else if(isdigit(ch))
  18.         printf("The character %c is a digit.", ch);
  19.     else if(islower(ch))
  20.         printf("The character %c is lower case.", ch);
  21.  
  22.     getch();
  23. }
Advertisement
Add Comment
Please, Sign In to add comment