Advertisement
afrinahoque

Whether character is alphabet, digit or special character

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