Advertisement
Drowze

07 Strings 05

May 11th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. /*Fazer  um  programa  que  leia  uma  string  e  gere  o  seu  inverso.  Por  exemplo,  se  for
  2. informada  a  string  ANTONIO,  o  programa  deverá  gerar  a  string  OINOTNA.  Exibir  a
  3. string original e a string invertido.*/
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8.  
  9. void main()
  10. {
  11.     char string1[150];
  12.     int i=0,j=0;
  13.  
  14.     printf("Digite uma frase que imprimirei cada palavra em uma linha\n");
  15.     gets(string1);
  16.  
  17.     for(i=0;string1[i];i++)
  18.     {
  19.         if(string1[i]==' ') printf("\n");
  20.         else printf("%c",string1[i]);
  21.     }
  22.     printf("\n");
  23.     system("pause");
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement