Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions

Question

=+ c. How would the change you describe in part

Answered: 1 week ago