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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started