Question: C# Create an array to store five integers. Ask the user to enter integers one at a time to populate this array. Every element in

C#

Create an array to store five integers. Ask the user to enter integers one at a time to populate this array. Every element in the array must be between 10 and 20, inclusive. Whenever an out-of-range value is entered, display an error message immediately and ask the user to enter another integer. All elements in the array must be unique. Whenever an entered value already exists in the array, display an error message immediately and ask the user to enter another integer. After the whole array is filled, display all five elements.

The following shows a test run of the program:

Enter an integer between 10 and 20, inclusive: 17

Enter an integer between 10 and 20, inclusive: 5

Sorry! Integer entered must be between 10 and 20, inclusive.

Enter an integer between 10 and 20, inclusive: 14

Enter an integer between 10 and 20, inclusive: 17

Sorry! This integer already exists in the array.

Enter an integer between 10 and 20, inclusive: 18

Enter an integer between 10 and 20, inclusive: 14

Sorry! This integer already exists in the array.

Enter an integer between 10 and 20, inclusive: 12

Enter an integer between 10 and 20, inclusive: 19

Elements in the array:

17

14

18

12

19

Press any key to continue . . .

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!