Advertisement
hmcristovao

Lista 04 - exerc 21

Jul 3rd, 2013
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2. #define MAX 100
  3. int main() {
  4.    char str[MAX];
  5.    printf("Entre com um nome:");
  6.    gets(str);
  7.    int i;
  8.    for(i=0; str[i]!='\0'; i++)
  9.       if(str[i]>='a' && str[i]<='z')
  10.          // a diferença 'a'-'A' corresponde a distância entre maiúsculos e minúsculos na tabela
  11.          str[i] = str[i] - ('a'-'A');
  12.  
  13.    printf("Nome maiusculo: %s", str);
  14.    return 0;
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement