2. Analyze the following program segment and determine how many times the body of the loop will be executed (show the working).
x = 5; y = 50;
while(x<=y)
y = y/x;
System.out.println(y);
Answers
Answered by
6
Answer:
Output:
10
2
Times executed =2 times
1st time- 5<=50, true
50/5=10
2nd time- 5<=10, true
10/5=2
3rd time - 5<=2 , false.
Hope it helps, follow for more answers
Similar questions