Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C# program to generate unique random integers. The program will ask the user three things: (a) number of random integers the user wants

Write a C# program to generate unique random integers. The program will ask the user three things:

(a) number of random integers the user wants to generate

(b) the lower limit of the random integers (i.e. how small the random integers can be)

(c) the upper limit of the random integers (i.e. how large the random integers can be)

Display the random numbers generated. These numbers are all unique (i.e. No two numbers are the same). The following is an example:

image text in transcribed

If the numbers of random integers the user want to generate is greater than the number of possible unique integers between the specified limits, display an error message and ask the user to re-enter his request:

image text in transcribed

In the example above, the user asks for 10 unique random integers in the range of 0 and 5. However, there are only 6 unique integers in this range: 0, 1, 2, 3, 4 and 5. Therefore, it is impossible for the program to satisfy the users request.

The user re-enter his request. The program generates a list of random integers the user asked for:

image text in transcribed

C:Windows system32\cmd.exe How many random number do you want to generate? 10 ow small can these random integers be? How large can these random integers be? 7 12 14 9 11 8 7 10 16 6 Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions