fork download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. int i,j;
  5. for(i=0; s[i]!='\0'; i++)
  6. ;
  7.  
  8. for(j=0; j<i/2; 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 5284KB
stdin
girafarig
stdout
girafarig -> 1