Answer my question fast!
No sparm answer
Answers
Hi
// 1st loop
// In condition we are making sure that "x" should be less than or equal to "y"------ 5 <= 50.. true
// y = 50/5.... so "y" became 10.. then we printed that on screen... "10"
// 2nd loop
// In condition we are making sure that "x" should be less than or equal to "y"------ 5 <= 10.. true
// y = 10/5.... so "y" became 2.. then we printed that on screen... "2"
// 3rd loop
// In condition we are making sure that "x" should be less than or equal to "y"------ 5 <= 2.. false!!!.. so we will get out f loop now..
so.. the output will be 10, 2
Sample Program:
x = 5, y = 50
while(x <= y)
{
y = y/x
System.out.println(y);
}
Actual Output: Compilation error
Expected output:
(i) 5 <= 50
{
y = (50/5) = 10
System.out.println(y); ----------- 10
(ii) 5 <= 10
{
y = (10/5) = 2
System.out.println(y); -------------- 2
(iii) 5 <= 2
Loop terminates.
Final output is:
10
2
Hope it helps!