C++ For Loop

The for loop is an entry -controlled loop which provides concise loop control structure. The for-loop statements are executed accordingly to initialization value, test expression and increment/decrement statement.

Syntax of C++ for Loop :-

for(initialization; test Expression; increment/decrement)

{

Body of Loop

}

Write a program to write all the natural no. till 10 ?

Solution :-

#include<conio.h>
#include<iostream.h>
void main()
{
int i;
for(i=1;i<=10;i++)
{
cout<<i<<endl;
}
getch();
}

Result :-

C++ for loop in tutorialworld.in

 Write a program to print natural no. in reverse order from 10 to 1.

 Write a program to print the below sequences.

star diagram using for loop in c++

 

 

 




Follow Us

Contact Us

tutorialworldin@yahoo.com

Back to Top