Computer Science, asked by kumkumverma117, 1 year ago

Analyse the following segment and determine how many times the loop will be executed and what     [02]      will be the output-

        int k = 1, i = 2;

        while (++ i <6)

        {     k * = i; }

        System.out.print(k);​

Answers

Answered by anishasa
6

ANSWER 60

Explanation:

1. 3<6

k= k*i

= 1*3

k=3

2. 4<6

= 3*4

k= 12

3. 5<6

= 12*5

k = 60

6<6

Fails

The loop will be executed 3 times

Similar questions