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