Question: Please write a C++ to calculate the sum and average of a sequence of integers. (Only use while-loop) The program asks the user to input
Please write a C++ to calculate the sum and average of a sequence of integers. (Only use while-loop)
The program asks the user to input the number of integers first (you don't need to validate the input). Write a loop that reads each integer and adds it to sum on each iteration.
You also need to calculate the average after the loop. Display the results with 4 digits after the decimal point.
Here is a sample run:
Enter the number of values: 3
Enter 3 integers: 25 56 38
The sum of integers is 119
The average of integers is 39.6667
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
