Question: Write a program to find the sum, average, range of N non-zero positive integers. This program asks user to enter the value of N.
Write a program to find the sum, average, range of N non-zero positive integers.
- This program asks user to enter the value of N. Here, N indicates the number of values
or terms from which user wants to sum, average, and range. This program then ask user
to enter each term or values.
- For example, suppose, a user entered N (number of value or term) as 4. Then the user
entered the following four (4) values as: 20, 40, 60, and 80. So, the sum will be
20+40+60+80=200. You need to enter each term/value using for loop. Now calculate
the sum.
- For calculating range, you need to subtract smallest number from the largest number.
- Once you get the sum, you can simply divide sum by N; you will get the average value.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
