Question: 1) What (if anything) is wrong with the following loop? int x = 1; while (x >10) { Console.WriteLine(x); x = x + 2; }

1) What (if anything) is wrong with the following loop? int x = 1; while (x >10) { Console.WriteLine(x); x = x + 2; }

A) Nothing.
B) It is an infinite loop.
C) The loop control variable is not initialized.
D)

The loop body will never execute

2) Your program asks to enter a number between 10 and 50. Which is the correct condition for the following validation loop?

int num; Console.Write("Please enter a number between 10 and 50:"); num = Convert.ToInt32(Console.ReadLine()); while (______________________________) { Console.WriteLine("invalid, please reenter a number between 10 and 50: "); num = Convert.ToInt32(Console.ReadLine()); }

A) num >= 10 && num <= 50
B) num < 10 || num > 50
C) num >= 10 || num <= 50
D) num < 10 && num > 50

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!