In the for loop body statement can be single or group of statements
In this above example Expression1 is initialization expression, expression2 is condition expression and in the last expression3 is an update expression. in the for loop, expression1 is executed only once when the loop start then initialize the loop variables.This expression is know as initialize or assignment expression because its initialize the value.expression2 is condition and its tested or check condition at every iteration of the loop, so this condition expression generally uses logical and relational operators. At the end expression3 is an update expression and its execute every time after execute the body of the loop.
/* program to understand the concept of for loop*/
#include <iostream>
int main()
{
int i;
for(i=0;i<=10;i++)
{
std::cout<<"C++ program";
}
return 0;
}
/* program to print 1 to 100 number using for loop*/
#include <iostream>
int main()
{
int i;
for(i=1;i<=100;i++)
{
std::cout<<i;