Advertisement
Guest User

Problem - 4 : alphabet, digit or special character

a guest
May 24th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.  
  6.     char ch;
  7.  
  8.     printf("Enter anything : ");
  9.     scanf("%c",&ch);
  10.  
  11.     if((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')){
  12.  
  13.         printf("%c is a Alphabet\n",ch);
  14.  
  15.     }
  16.  
  17.     else if(ch >= '0' && ch <= '9'){
  18.  
  19.         printf("%c is  a Digit\n",ch);
  20.  
  21.     }
  22.  
  23.     else {
  24.  
  25.         printf("%c is a Special Character\n",ch);
  26.  
  27.     }
  28.  
  29.     return 0;
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement