Output writing and loop counting
ICSE2017
Problem Statement - Output writing and loop counting
Analyze the given program segment and answer the following questions:
for(int i=3;i<=4;i++ ) {
for(int j=2;j<i;j++ ) {
System.out.print(“” ); }
System.out.println(“WIN” ); }
(i) How many times does the inner loop execute?
(ii) Write the output of the program segment.
Solution
CSKC| Created: 15-Apr-2019 | Updated: 27-Nov-2019|ICSE2017