fork(1) 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. int j=count;
  20. for (int i = 0; i <= count/2; i++)
  21. {
  22. j--;
  23. {
  24. if (a[i]!=a[j]) b=0;
  25. else b=1;
  26. }
  27.  
  28. }
  29. if (b==1)
  30. {
  31. printf("day la so dao nguoc");
  32. }
  33. else if (b==0)
  34. {
  35. printf("day khong phai so dao nguoc");
  36. }
  37. }
  38.  
  39. int main(void) {
  40. sodaonguoc(1223);
  41. return 0;
  42. }
  43.  
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
day la so dao nguoc