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