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