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