Write a program that calculates the average of n integers


Write a program that calculates the average of N integers. The program should prompt the user to enter the value for N and then afterward must enter all N numbers. Use an array to save the N integers. If the user enters a nonpositive value for N, then an exception should be thrown (and caught) with the message "N must be positive." If there is any exception as the user is entering the N numbers, an error message should be displayed, and the user prompted to enter the number again.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Write a program that calculates the average of n integers
Reference No:- TGS01682985

Now Priced at $20 (50% Discount)

Recommended (93%)

Rated (4.5/5)