Computer Science, asked by suchetaguha, 7 months ago

2
class dk 2.
public static vad main string args II
int i =2, k=1:
while (+ + i <6)
k*-=i.
sopln(k)
}
}​

Answers

Answered by sanjiththesupernigha
0

Answer:

Output:

60

Explanation: Here, we have first initialized the two variables i and k with the values 2 and 1 respectively. After this we have used a while loop with the condition ++i < 6. Thus, the value of i will increase by 1 before it can be used further because of a preceding ++ operator in the condition. So, the value of i will become 2 then. Now, the while loop will check the condition if 2 is greater than 6. Then it will move forward to the next statement where the value of k will be equal to k * i (as k *= i or k = k * i are the same). So the value of k will become 3 ( as i = 3 and k = 1). This will continue till the required condition (++i < 6) is met. And finally the value of k will become 60 at last and the output will be 60.

Explanation:

Similar questions