140k views
2 votes
Given the code below, how many times would "I love C#" be output to the Console Window?

1
int counter = 10;
2
while (counter>5) {
3
Console.WriteLine("I love C#");
4
counter++;
5
}
C#

0

10

11

Infinite Loop

User Leyou
by
6.9k points

2 Answers

2 votes
I'm relatively new to coding but that looks like an infinite loop.
User Neilmarion
by
7.1k points
4 votes
The answer is infinite loop the program would continue executing since the statement parameters are met by counter 10 being greater than 5
User Elephantik
by
7.2k points