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