dimanche 8 août 2021

How to generate random numbers between 1 and 20 [duplicate]

the program should generate random numbers between 1 and 20. The program should ask a user to guess the random number, then display the random number and a message indicating whether the user’s guess was too high, too low, or correct. Using if-statement

I have tried this:

using System;

namespace GradedLab1_DSW01B1_220023913
{
    class Program
    {
        static void Main(string[] args)
        {
            var random = new Random();
            int randomnumber = random.Next(20);

            Console.WriteLine(randomnumber);

            Console.ReadKey();
        }
    }
}



Aucun commentaire:

Enregistrer un commentaire