Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Need help with loops in programming in particular C#?

How many times will the body of the while loop be executed if x has the value 11 at

the start of the loop?

while (x > 0){

System.Console.WriteLine(x);

x -= 2;

}

Which of the following loops terminate? Assume that x has the value 7 at the start of

the loop.

a. while (x < 75) b. while (x > 0)

x += 11; x += 11;

1 Answer

Relevance
  • 7 years ago
    Favorite Answer

    the output values are 11, 9, 7, 5, 3, 1 (6 times)

    a) is stable and quits in a few interations, b) will run forever

Still have questions? Get your answers by asking now.