What are the 3 statement comprising for loop
Answers
Answered by
1
In a for loop, there are three statements:
Example:
for ( initialization; condition; increment )
{
\\ Statement goes here
}
Initialization:
The variable is assigned, which would be used in the for loop through the lifetime of the loop.
e.x., int a = 0;
Condition:
It is the statement which will stop the for loop from looping infinitely.
e.x., a < 5;
Increment:
It defines how the value of the variable will change through out the loop.
e.x., a++
Similar questions