Mean, Variance, and Standard Deviation

Medium

Read an integer N followed by N real numbers, store them in an array, and print three lines: mean = 5.00, variance = 4.00, standard deviation = 2.00, each to two decimal places. The mean is the sum divided by N, the variance is the sum of the squared differences from the mean divided by N (population variance), and the standard deviation is the square root of the variance. Use two loops: one to read and sum, one to measure the differences. N must be between 1 and 100; otherwise print N must be between 1 and 100 and return 1. If N or any value cannot be read, print invalid input and return 1.

Success Criteria

Your code must pass 7 test case(s) to complete this exercise. 3 hint(s) are available if you need help.

Sign in to track your progress

You can work on exercises as a guest, but sign in to track your progress and save your submissions.

This platform is built by its community

Every lesson, project, and tool on HelloC++ is funded by sponsors. Join them and help shape what we build next.

Become a Patron

How did you find this exercise?

Your rating helps us improve the content.