Create a C# program that prompts the user for 2 integers and displays a random number on the screen between those values. You can use the .NET Random object.
public class RandomNumber
public static void Main(string args)
int n1 = int.Parse(Console.ReadLine());
int n2 = int.Parse(Console.ReadLine());
Random rnd = new Random();
int number = rnd.Next(n1, n2 + 1);
Practice C# anywhere with the free app for Android devices.
Learn C# at your own pace, the exercises are ordered by difficulty.
Your donations support our work and contribute to the maintenance of the app.
Own and third party cookies to improve our services. If you go on surfing, we will consider you accepting its use.