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