Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.89 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6. int main()
  7. {
  8.     char p[101];
  9.     int i,m=0;
  10.  
  11.         scanf("%s",p);
  12.  
  13.                 for(i=0 ; i < strlen(p) ; i++){
  14.  
  15.                     if(isupper(p[i])){
  16.  
  17.                         m++;
  18.                     }
  19.  
  20.                     if(m == strlen(p)){
  21.  
  22.                         for(i = 0 ; i < strlen(p) ; i++){
  23.  
  24.                             p[i] = tolower(p[i]);
  25.  
  26.                         }
  27.                          printf("%s\n",p);
  28.                     }
  29.  
  30.                    else if(m == strlen(p)-1){
  31.  
  32.                         for(i = 1 ; i < strlen(p) ; i++){
  33.  
  34.                             p[i] = tolower(p[i]);
  35.                             p[0] = toupper(p[0]);
  36.  
  37.                         }
  38.                          printf("%s\n",p);
  39.                     }
  40.  
  41.  
  42.                 }
  43.  
  44.  
  45.     return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement