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