The C++ for loop is used to iterate a part of the program several times. If the number of iteration is fixed, it is recommended to use for loop than while or do-while loops.The C++ for loop is same as C/C#. We can initialize variable, check condition and increment/decrement value.
Syntax:
for(initialization; condition; increment/decrement){
//code to be executed
}
Example:
#include<iostream>
using namespace std;
int main(){
for(int i; i<=10; i++)
{
cout<<i<<endl;
}
return 0;
}