I want to execute the contents of the loop a maximum of 3 times, and every time the program runs, I want it to create a different number. So the first run can be 2, then 3, then 1, then 2, etc.
Here is the code I wrote:
int i = new Random().Next(3);
while (i <= 3)
{
Console.WriteLine("Hello World");
i--;
}**
However, this ends with an endless loop. Can someone help me understand what I'm doing wrong?
THANKS!
source
share