for ( variable initialization; condition; variable increment/assignment ) {
Code to execute while the condition is true
}
For Loop Example Program
/* Example Program For for Loop In C++
little drops @ thiyagaraaj.com
Coded By:xyz */
#include<iostream>
#include<conio.h>
using namespace std;
int main() {
// Variable Declaration
int a;
// Get Input Value
cout << "Enter the Number :";
cin>>a;
//for Loop Block
for (int counter = 1; counter <= a; counter++) {
cout << "Execute " << counter << " time" << endl;
}
// Wait For Output Screen
getch();
return 0;
}
If the answers is incorrect or not given, you can answer the above question in the comment box. If the answers is incorrect or not given, you can answer the above question in the comment box.