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