Twist_Nemo

check uppercase and lowercase alphabets in c

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