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()); }
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
