fork download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. int st=0;
  5. int end=0;
  6. while (s[end]!='\0'){
  7. end++;
  8. }
  9. end--;
  10.  
  11. while(st<end){
  12. if(s[st]!=s[end]){
  13. return 0;
  14. }
  15. st++;
  16. end--;
  17. }
  18. return 1;
  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 5280KB
stdin
repaper
stdout
repaper -> 1