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