fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int i;
  8.  
  9. cout << "I am going to list numbers now:" << endl;
  10.  
  11. // for loop allows us to initialize variable,
  12. // specify the condition, and also the way the
  13. // variable changes in each iteration of the loop
  14.  
  15. for (i=0; i<100; i++)
  16. if (i==5)
  17. cout << i << endl;
  18.  
  19. cout << "The loop was terminated with i = " << i << endl;
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0.02s 2724KB
stdin
Standard input is empty
stdout
I am going to list numbers now:
5
The loop was terminated with i = 100