fork download
  1. #include <stdio.h>
  2. int isPalindrome(char s[]){
  3. int i = 0;
  4. int j = 0;
  5. while (s[j] != '\0') {
  6. j++;
  7. }
  8. j--;
  9. while (i < j) {
  10. if (s[i] != s[j]) {
  11. return 0;
  12. }
  13. i++;
  14. j--;
  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. }
  24.  
Success #stdin #stdout 0s 5320KB
stdin
qwewq
stdout
qwewq -> 1