Write about nested loop, with syntax and an example.
{JAVA}
Answers
Answered by
9
Answer:
I hope it helpful to you..
Attachments:
Answered by
5
Answer:
Nested loop means a loop statement inside another loop statement. That is why nested loops are also known as “loop inside loop“.
Syntax for Nested for() loop:
for ( initialization; condition; increment ) {
for ( initialization; condition; increment ){
// statement of inside loop
}
// statement of outer loop
}
Example:
for(int i=1;i<=r; i++) // outer loop
{
for(int j=1;j<=r;j++) // inner loop
{
System.out.print("# ");
} // end of j loop
System.out.println();
} // end of i loop
Similar questions