vendredi 22 février 2019

C#: Generate 100 random numbers between 1-1000 and output the max value

I'm very new to coding and I just can't wrap my head around Loops/Arrays/Randoms. I understand the concept but when it comes to applying it, I'm just lost.

Here I'm trying to generate 100 random numbers between 1-1000 and it has to output the maximum value. Here's my code so far:

Random rnd = new Random();
int nums = rnd.Next(0, 1001);
for (int i = 1; i <= 100; i++)
{

}
Console.WriteLine(nums);
Console.ReadLine(); 

It's only giving me one number. :( I'd greatly appreciate any help!

Thanks!




Aucun commentaire:

Enregistrer un commentaire