So today I wrote this simple code:
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Random random = new Random();
int num = 0;
bool ans = false;
for (int i = 0; i < 100; i++)
{
num = random.Next(700,801);
Console.WriteLine(num);
if (num == 777)
{
ans = true;
}
}
Console.WriteLine("Was 777 generated?" + " " + ans);
Console.ReadLine();
}
}
}
And when I tried running it I have noticed that when I use Ctrl+F5 to run it, it only generates 28 numbers instead of 100, but when I use the 'Run' button it does generate 100 numbers a expected. the last lines of the output
I have tried to restart Visual Studio, which did not work. I have tried to rewrite the program, which did not work. For some reason running it using Ctrl+F5 still only generated 28 numbers.
Aucun commentaire:
Enregistrer un commentaire