fork download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. // счётчик до окончания цикла
  6. int cnt = 10;
  7. int i = 1;
  8. for(;;){
  9. std::cout << i << std::endl;
  10. if(i < 1000000) i *= 1000;
  11. else i = 1;
  12. if(!cnt--) break;
  13. }
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 4256KB
stdin
Standard input is empty
stdout
1
1000
1000000
1
1000
1000000
1
1000
1000000
1
1000