Advertisement
weldisalves

Lista 04 - exercício 21 - sem string.h

Jul 8th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1.     #include <stdio.h>
  2.     #define MAX 100
  3.  
  4.     //21. Solicite o nome do usuário e o exiba convertendo todas as letras para maiúsculo.
  5.  
  6.     int main()
  7.     {
  8.         char nome[MAX];
  9.         int i;
  10.  
  11.         printf("\n Digite o nome do usuario: ");
  12.         fgets(nome,MAX,stdin);
  13.  
  14.         for(i=0;i<nome[i]!='\0';i++)
  15.         {
  16.             if (nome[i]>=97)
  17.             printf("%c",nome[i]-('a'-'A'));
  18.             else
  19.             printf("%c",nome[i]);
  20.         }
  21.  
  22.         getchar();
  23.         return 0;
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement