Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.06 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.     char nome[50];
  8.     int i=0,tam=0,espaco=0;
  9.    
  10.     printf("informe seu nome: ");
  11.     scanf("%[^\n]s",&nome);
  12.    
  13.    
  14.     printf("\ntamanho do nome eh: %d",strlen(nome));
  15.    
  16.     tam=strlen(nome);
  17.     printf("\nnome inverso: ");
  18.     for (i=tam;i<nome;i--){
  19.         printf("%c",nome[i]);
  20.        
  21.     }
  22.    
  23.     printf("\no nome maiusculo eh: ");
  24.     for(i=0;i<tam;i++){
  25.         printf("%c",toupper(nome[i]));
  26.     }
  27.     printf("\no nome minusculo eh: ");
  28.     for(i=0;i<tam;i++){
  29.         printf("%c",tolower(nome[i]));
  30.     }
  31.     for(i=0;i<tam;i++){
  32.         if(nome[i]==' '){
  33.             espaco=i;
  34.         }
  35.     }
  36.     printf("\nprimeiro nome: ");
  37.     for(i=0;i<espaco;i++){
  38.         printf("%c",nome[i]);
  39.     }
  40.     printf("\nsegundo nome: ");
  41.     for(i=espaco+1;i<tam;i++){
  42.         printf("%c",nome[i]);
  43.     }
  44.     printf("\nsua passagem aeria: ");
  45.     for(i=espaco+1;i<tam;i++){
  46.         printf("%c",toupper(nome[i]));
  47.     }
  48.     printf("/");
  49.     for(i=0;i<espaco;i++){
  50.         printf("%c",tolower(nome[i]));
  51.     }
  52.     printf("\nVolte sempre");
  53.    
  54.    
  55.    
  56.    
  57.    
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement