Advertisement
Nabil-Ahmed

Untitled

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