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!!