Computer Science, asked by npalkrishna2001, 7 months ago

int k=1;i=2;.
while(++I<6)
k*=I;
system.out.println(k);


output of the program
how many times the loop will be executed​

Answers

Answered by pavithranatarajan855
31

Answer:

output is:

60

Explanation:

In first iteration 3<6 true k=1*3=3

In 2nd iteration 4<6 true k=3*4=12

In 3rd iteration 5<6 true k=12*5=60

In next iteration 6<6 condition false so loop ends

final value of k is 60.

Hope this is useful!

Answered by stalwartajk
0

Answer:

Output  : 120

Loop will execute 3 times .

what is loop ?

a Loop is used to execute a group of instructions or a block of code multiple times, without writing it repeatedly.

Explanation:

The output of the program will be:

k = 120

The loop will be executed 3 times

since the initial value of i is 2 and the loop condition is i<6. Therefore, the loop will iterate for i=3, i=4, and i=5. On each iteration, i is incremented by 1 and k is multiplied by i, starting with k=2*3=6 and ending with k=2*3*4*5=120. Finally, the value of k is printed to the console using System.out.println(k).

To learn more about loops follow the given link :

https://brainly.in/question/5900811

https://brainly.in/question/10279920

#SPJ3

Similar questions