Write a program to find the sum, average, range of N non-zero positive integers. This program
Fantastic news! We've Found the answer you've been seeking!
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. 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.
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date: