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