Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1.  
  2. //Check whether a character is alphabet, digit or special character//
  3. #include<stdio.h>
  4. int main()
  5. {
  6.     char ch;
  7.     printf("Enter any character:");
  8.     scanf("%c",&ch);
  9.     if((ch>='a' && ch<='z') || (ch>='A' && ch<='Z'))
  10.     {
  11.         printf("is an alphabet\n",ch);
  12.     }
  13.     else if(ch>='0' && ch<='9')
  14.     {
  15.         printf("is a digit\n",ch);
  16.     }
  17.     else
  18.     {
  19.         printf("is a special character\n",ch);
  20.  
  21.     }
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement