sivan_iut

Untitled

Feb 17th, 2020
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     char sivan[100];
  5.     gets(sivan);
  6.     int countu=0;
  7.     int countl=0;
  8.     int i;
  9.     for(i=0; sivan[i]!='\0'; i++)
  10.  
  11.     {
  12.         if('A'<=sivan[i] && sivan[i]<='Z')
  13.             countu++;
  14.         else if('a'<=sivan[i] && sivan[i]<='z')
  15.             countl++;
  16.     }
  17.     if(countu==countl)
  18.     {
  19.         i=0;
  20.         while (sivan[i])
  21.         {
  22.             sivan[i] =tolower(sivan[i]);
  23.             i++;
  24.             printf("%c",sivan[i]);
  25.  
  26.         }
  27.     }
  28.     else if(countu>countl)
  29.     {
  30.         i=0;
  31.         while (sivan[i])
  32.         {
  33.             sivan[i] =toupper(sivan[i]);
  34.             i++;
  35.             printf("%c",sivan[i]);
  36.  
  37.         }
  38.     }
  39.     else if(countl>countu)
  40.  
  41.     {
  42.         i=0;
  43.         while (sivan[i])
  44.         {
  45.             sivan[i] =tolower(sivan[i]);
  46.             i++;
  47.             printf("%c",sivan[i]);
  48.  
  49.         }
  50.     }
  51.  
  52. }
  53. return 0;
  54. }
Add Comment
Please, Sign In to add comment