Advertisement
thenewboston

C Programming Tutorial - 33 - isupper and Challenge #1!

Aug 22nd, 2014
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5. #include <math.h>
  6.  
  7. int main()
  8. {
  9.     //you can use ints and characters interchangeably in most cases
  10.     int tuna = 'B'; // b, 7, $
  11.  
  12.     if( isalpha(tuna) ){
  13.  
  14.         if( isupper(tuna) ){
  15.             printf("%c is an upper case letter \n", tuna );
  16.         }else{
  17.             printf("%c is a lower case letter \n", tuna );
  18.         }
  19.  
  20.     }else{
  21.  
  22.         if( isdigit(tuna) ){
  23.             printf("%c is a number \n", tuna );
  24.         }else{
  25.             printf("%c is not a OMG IDK! \n", tuna );
  26.         }
  27.  
  28.     }
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement