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