Advertisements
Advertisements
Question
Write the output of the following program code.
int r=0, c=0;
for (r=1; r<=5; r++)
{
for(c=1; c<=r; c++)
{
System.out.print(" "+c);
}
System.out.println ();
}Very Short Answer
Advertisements
Solution
| 1 | ||||
| 1 | 2 | |||
| 1 | 2 | 3 | ||
| 1 | 2 | 3 | 4 | |
| 1 | 2 | 3 | 4 | 5 |
shaalaa.com
Is there an error in this question or solution?
Chapter 1: Revision of Class 9 Syllabus - Exercises [Page 48]
