Advertisement
LightProgrammer000

Letras [Maiúsculas <-> Minúsculas]

Dec 1st, 2018
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. // Biblioteca
  2. #include <stdio.h>
  3. #include <ctype.h>
  4.  
  5. int main()
  6. {
  7.     int i = 0;
  8.     char texto[100];
  9.  
  10.     printf("\n Digite o texto \n ->");
  11.     scanf("%s", texto);
  12.  
  13.     while( texto[i] != '\0' )
  14.     {
  15.         // Verificação: O caractere está maiúsculo ? sim(Color em minúsculo) : nao
  16.         if( isupper(texto[i]) )
  17.         {
  18.             printf("%c", tolower(texto[i]));
  19.         }
  20.  
  21.         // Verificação: O caractere está minúsculo ? sim((Color em maiúsculo) : nao
  22.         if( islower(texto[i]) )
  23.         {
  24.             printf("%c", toupper(texto[i]));
  25.         }
  26.  
  27.         i++;
  28.     }
  29.     return(0);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement