fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int k = 0;
  6. int d = 2;
  7.  
  8. for (int n=0; n< 10; n++) {
  9. cout << k << endl;
  10. k+= n%d==0;
  11. cout << k << endl << "-----" << endl;
  12. }
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
0
1
-----
1
1
-----
1
2
-----
2
2
-----
2
3
-----
3
3
-----
3
4
-----
4
4
-----
4
5
-----
5
5
-----