C++ Programming Code Examples C++ > For Loops and While Loops Code Examples Program of a Simple For loop in C++ Program of a Simple For loop in C++ Here in the loop initialization part I have set the value of variable i to 1, condition is i<=18 and on each loop iteration the value of i increments by 1. #include <iostream> using namespace std; int main(){ for(int i=1; i<=18; i++){ /* This statement would be executed repeatedly until the condition i<=18 returns false. */ cout<<"Value of variable i is: "<<i<<endl; } return 0; }