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