Advertisement
Imran1107048

String reverse

Nov 27th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main()
  5. {
  6. int l=0,i=0;
  7. char temp,ch[1000];
  8. gets(ch);
  9. l=strlen(ch)-1;
  10. while(i<l)
  11. {
  12. temp=ch[i];
  13. ch[i]=ch[l];
  14. ch[l]=temp;
  15. i++;
  16. l--;
  17. }
  18. printf("%s",ch);
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement