Question: Write a C++ program to create an integer array having a random size between 5 and 95. To each integer in the array, assign a

Write a C++ program to create an integer array having a random size between 5 and 95.

To each integer in the array, assign a random value between 1 and 99. Display the values in the array on a single line on the console, by accessing them from the array.

Calculate and display the average value of the integers in the array, by accessing them from the array, and using a FOR loop.

To generate random numbers use this code: #include #include

In main: srand(time(NULL)); // set current time as seed for random generator

// use once only at the top in main

To generate a random variable between 3 and 93, the program code is: int random_variable = rand() % 91 + 3; // The expression rand() % 91 generates values in the range 0 to 90.

// The expression rand() % 91 + 3 generates values in the range 3 to 93.

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!