Question: Write a program that: a) Inputs a positive integer n from the keyboard where n

Write a program that:

a) Inputs a positive integer n from the keyboard where n<=50. If n is out of range then print out an error message and ask for another input. This process repeats until a valid value for n is obtained. b) Inputs two 1D arrays of doubles A and B (of size n) from the keyboard. c) Inputs an integer k (1-3) from the keyboard. d) If k = 1 then it calculates the average value of A[i] and prints it to the screen. e) If k = 2 then it calculates the maximum value of B[i] and prints it to the screen. f) If k = 3 then it reverses the elements of A and prints A to the screen. (Do not introduce another array or use any library functions)

For example if A = [2 7 5 25 10] results in A = [10 25 5 7 2].

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!