fork download
  1. #include <iostream>
  2. #include <stack>
  3.  
  4. int main()
  5. {
  6. for (int i = 1345; i <= 1349; ++i)
  7. {
  8. int t = i;
  9. std::stack<int> st;
  10. do
  11. {
  12. st.push(t % 10);
  13. }
  14. while (t /= 10);
  15.  
  16. while (!st.empty())
  17. {
  18. std::cout << st.top() << " ";
  19. st.pop();
  20. }
  21. }
  22. std::cout << std::endl;
  23. }
Success #stdin #stdout 0.01s 2860KB
stdin
Standard input is empty
stdout
1 3 4 5 1 3 4 6 1 3 4 7 1 3 4 8 1 3 4 9