Microsoft
98-361 · Question #328
You are developing a C# program that needs to perform 5 iterations. You write the following code: 01: int count = 0; 02: while (count <= 5) 03: { 04: Console.WriteLine("The value of count = {0}"…
The correct answer is A. Change the code in line 01 to. See the full explanation below for the reasoning.
Question
You are developing a C# program that needs to perform 5 iterations. You write the following code:
01: int count = 0; 02: while (count <= 5) 03: { 04: Console.WriteLine("The value of count = {0}", count); 05: count++; 06: } When you run the program, you notice that the loop does not iterate five times. What should you do to make sure that the loop is executed exactly five times?
Options
- AChange the code in line 01 to
- BChange the code in line 02 to:
- CChange the code in line 02 to
- DChange the code in line 05 to
How the community answered
(61 responses)- A84% (51)
- B5% (3)
- C10% (6)
- D2% (1)
Community Discussion
No community discussion yet for this question.