Advertisement
Vasilena

PracticeDayTwoExercises6,7,8,9

Jul 7th, 2021 (edited)
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.18 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. //Ex6
  5. int Lower(char sym){
  6.     if(sym >= 'a' && sym <= 'z'){
  7.        printf("Yes");
  8.        return 0;
  9.     }else{
  10.        printf("No");
  11.        return 0;
  12.     }
  13. }
  14.  
  15. //Ex7
  16. int Upper(char sym){
  17.     if(sym >= 'A' && sym <= 'Z'){
  18.         printf("Yes");
  19.         return 0;
  20.     }else{
  21.         printf("No");
  22.         return 0;
  23.     }
  24. }
  25.  
  26. //Ex8
  27. int Letter(char sym){
  28.     if(sym >= 'A' && sym <= 'Z')
  29.     {
  30.         printf("Upper");
  31.         return 0;
  32.     }
  33.     else
  34.     {
  35.         printf("Lower");
  36.         return 0;
  37.     }
  38. }
  39.  
  40. //Ex9
  41. int DigOrLet(char sym){
  42.     if(sym >= '0' && sym <= '9')
  43.      {
  44.         printf("Digit");
  45.         return 0;
  46.     }
  47.     else
  48.     {
  49.         printf("Letter");
  50.         return 0;
  51.     }
  52. }
  53.  
  54. int main(){
  55.     printf("------------------Exercise6------------------\n");
  56.     printf("%c\n", Lower('6'));
  57.     printf("------------------Exercise7------------------\n");
  58.     printf("%c\n", Upper('V'));
  59.     printf("------------------Exercise8------------------\n");
  60.     printf("%c\n", Letter('a'));
  61.     printf("------------------Exercise9------------------\n");
  62.     printf("%c\n", DigOrLet('5'));
  63.     return 0;
  64. }
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement