Question: Write a program that can be used to compute the sum, sum of squares, mean or average and standard deviation of a few numbers that

  1. Write a program that can be used to compute the sum, sum of squares, mean or average and standard deviation of a few numbers that are entered by the user.

You need to use a while loop with loop count starting from 1 to N where N is number of data entered.

Initialize sum and sum of squares to 0, and then within the loop, add the new number to sum and square of the new number to sum of square.

To compute the sum, you can use: sum = sum + number;

For sumOfSquare, use, sumOfSquare = sumOfSquare + pow(number, 2);

After exiting the loop, find the average and standard deviation from the following:

average = sum/N

standardDeviation = sumOfSquare- sum2n(n-1)

Display the sum, sumOfSquare, average and standard deviation using a precision of 2 (i.e displaying 2 digits after the decimal).

Declare all the variables, sum, sumOfSquare, standardDeviation as floating-point variables.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!