fork(6) download
  1. #include <stdio.h>
  2.  
  3. int isIntPalindrome(int x)
  4. {
  5. if (x < 0)
  6. return 0;
  7. int div = 1;
  8. while (x / div >= 10)
  9. {
  10. div *= 10;
  11. }
  12.  
  13. while (x != 0)
  14. {
  15. int l = x / div;
  16. int r = x % 10;
  17. if (l != r)
  18. return 0;
  19. x = (x % div) / 10;
  20. div /= 100;
  21. }
  22. return 1;
  23. }
  24.  
  25. int main(void) {
  26. // your code goes here
  27.  
  28. printf("%d", isIntPalindrome(10901));
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0s 2168KB
stdin
Standard input is empty
stdout
1