Advertisements
Advertisements
प्रश्न
What is a nested loop?
संक्षेप में उत्तर
उत्तर
'A nested loop is one that uses another loop within itself. In the example below, the outer loop is executed three times. The inner loop is executed twice per outer loop iteration. Therefore, the pattern printed will be:
MM
MM
MM
Example:
for (int i = 1; i <= 3; i++)
{for (int j = 1; j <= 2; j++)
System.out.print("M");
System.out.printIn();
}
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?