English

Analyze the following program segment and determine how many times the loop will be executed. What will be the output of the program segment?

Advertisements
Advertisements

Question

Analyze the following program segment and determine how many times the loop will be executed. What will be the output of the program segment?

int k = 1, i = 2; 
while (++i < 6) 
k *= i; 
System.out.println(k);
Answer in Brief
One Line Answer
Advertisements

Solution

3 times = 60

shaalaa.com
  Is there an error in this question or solution?
Chapter 1.09: Iterative Constructs in Java - EXERCISES [Page 123]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 1.09 Iterative Constructs in Java
EXERCISES | Q III. 4. | Page 123
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×