fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int bil, balik = 0, mod;
  6. cin >> bil;
  7.  
  8. while(bil > 0) {
  9. mod = bil%10;
  10. balik = balik*10 + mod;
  11. bil = bil/10;
  12. cout << bil << endl;
  13. cout << balik << endl << endl;
  14. }
  15.  
  16. // Mat
  17. // 12345 = 1234*10 + 5
  18. // 12345/10 = 1234 + 5/10
  19.  
  20. // C++
  21. // 12345/10 = 1234
  22. // 12345%10 = 5
  23.  
  24. // 0
  25. // 54321
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0.01s 5276KB
stdin
12345
stdout
1234
5

123
54

12
543

1
5432

0
54321