Computer Science, asked by JatinBharadwaj1606, 3 months ago

how many times are the following loop bodies repeated? What is the final output in each case?

(i) int x = 1;
while (x < 10)
if (x % 2 == 0)
System.out.println(x);

(i)int y = 1;
while (y < 10)
if (y % 2 == 0)
System.out.println(y++);

(i)int z = 1;
while (z < 10)
if ((Z++) % 2 == 0)
System.out.println(z);​

Answers

Answered by Anonymous
9

I) the while loop will be repeated until x equals 10 i.e 9 times.

Final output:

  • 2
  • 4
  • 6
  • 8

In every case,loop will repeat 9 times...


Anonymous: usko kyu pareshan kr rha
Anonymous: usko dekh lega na to kya pta tm behos jayega
Anonymous: sukhi pataka hai
Anonymous: poori ki poori khaali hai
Anonymous: ekdm bkbas hai
Anonymous: thoo
Similar questions