fork download
  1. #include <stdio.h>
  2.  
  3. #define max 50
  4.  
  5. void sodaonguoc(int x){
  6. int b;
  7. int count=0;
  8. int a[max];
  9. int i=0;
  10. while (x!=0)
  11. {
  12. int d=x%10;
  13. x/=10;
  14. count++;
  15.  
  16. a[i]=d;
  17. i++;
  18. }
  19. b = 1;
  20. for (int i = 0, j = count - 1; i < j; i++, j--) {
  21. if (a[i] != a[j]) {
  22. b = 0;
  23. break;
  24. }
  25. }
  26. if (b==1) {
  27. printf("day la so dao nguoc");
  28. }
  29. else if (b==0) {
  30. printf("day khong phai so dao nguoc");
  31. }
  32. }
  33.  
  34. int main(void) {
  35. sodaonguoc(12223);
  36. return 0;
  37. }
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
day khong phai so dao nguoc