info for loop in c++:-
A loop is used for executing a block of statements repeatedly until a particular condition is satisfied. For example, when you are displaying number from 1 to 100 you may want set the value of a variable to 1 and display it 100 times, increasing its value by 1 on each loop iteration.
In C++ we have three types of basic loops: for, while and do-while. In this tutorial we will learn how to use “for loop” in C++.
- syntax:-
for(initialization; condition ; increment/decrement) { C++ statement(s); }
Flow of Execution of the for Loop:-
- prog to print the table of 7 up till 70 using for loop:-
#include<iostream.h>
void main()
{
int m;
for (m=7;m<=70;m+=70)
{
cout<<m<<endl;
}
}
note:-it's just a sudo code if its not executing on your device make some changes in the further code this is only for understanding logic.
0 Comments