English

Predict the output: int i, j; for (j = 1; j <= 5; j += 2) { for (k = 1; k <= j; k++) System.out.print(k); System.out.println(); } - Computer Applications

Advertisements
Advertisements

Question

Predict the output:

int i, j;
for (j = 1; j <= 5; j += 2)
{
     for (k = 1; k <= j; k++)
        System.out.print(k);
System.out.println();
}
Answer in Brief

Solution

1
123
12345 

shaalaa.com
  Is there an error in this question or solution?
Chapter 1.1: Nested Loop - Review Insight [Page 143]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 1.1 Nested Loop
Review Insight | Q 4. | Page 143
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×