Loop
1)In a program, a block of codes is repeated continuosly,until the conditions become false
2)It consist of 3 looping Statement
while loop:
1)At first it will intialize the value
2)Then the value will check by the condition,
3)If the value satisfy the condition,then it will increment the value,
until the condition fails
Syntax:
int value; // intialization
while(condition) // condition
{
statement;
i++; // incrementation
}
for loop:
1)The process of the for loop is same as the while loop
2)But the intialization,condition,incrementation are in a same line
3)Compare to the while loop the no of lines were reduced
syntax:
for(inilization,condition,increament)
{
statement;
}
Top comments (0)