Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.79 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<stdlib.h>
  4. void wordreverse(char xy[]);
  5. int main()
  6. {
  7.     while(1)
  8.     {
  9.     char x[9000], xy[9000][30];
  10.     gets(x);
  11.     int i=0, l=strlen(x), w=0, j=0;
  12.     while(i<=l)
  13.     {
  14.         if(x[i]==' '||x[i]=='\0')
  15.         {
  16.             xy[w][j]='\0';
  17.             wordreverse(xy[w]);
  18.             if(i!=l)printf(" ");
  19.             else printf("%c\n\n", '\0');
  20.             w++;
  21.             j=0;
  22.         }
  23.         else
  24.         {
  25.             xy[w][j]=x[i];
  26.             j++;
  27.         }
  28.         i++;
  29.     }
  30.     }
  31.     return 0;
  32. }
  33. void wordreverse(char xy[])
  34. {
  35.     fflush(stdin);
  36.     char x[30];
  37.     int l=strlen(xy)-1, i=0;
  38.     while(l>=0)
  39.     {
  40.         x[i]=xy[l];
  41.         i++;
  42.         l--;
  43.     }
  44.     x[i]='\0';
  45.     printf("%s", x);
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement