Many Lines Printed Console Following Loops Executed Int 1 5 2 Int J 0 J J Systemprintln J Q37042636

How many lines are printed on the console when the following forloops are executed?
for (int i = 1; i < 5; i += 2) {
    for (int j = 0; j < i; j++) {
        System.out.println(j);
    }

}

a.

4

b.

5

c.

20

d.

2


Solution


a. 4

Please let me know if you have any doubts Please upvote this answer. Thanks!!

Please let me know if you have any doubts Please upvote this answer. Thanks!!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.