fork(1) download
  1. #include <stdio.h>
  2.  
  3. int setPalindrome(char s[]){
  4. int i=0;
  5. int j=0;
  6. int k=0;
  7. char t[100];
  8. while(s[i]!='\0')
  9. {
  10. i++;
  11. };
  12. for(i=i-1;i>=0;i--){
  13. t[j]=s[i];
  14. printf("%c",t[j]);
  15. j++;
  16. };
  17. t[j]='\0';
  18. return 0;
  19. };
  20.  
  21.  
  22. int main(){
  23. char s[100];
  24. scanf("%s",s);
  25. printf("%s",s);
  26. setPalindrome(s);
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 5348KB
stdin
ghi
stdout
ghiihg