Example 43: Calculate Sum, Average, and Standard Deviation

Learn how to calculate the sum, average, and standard deviation of the given numbers using pointers.

Problem

Write a function that calculates the sum, average, and standard deviation of the given numbers. It receives five integers along with three pointers to store the results as parameters.

Example

Input (n1, n2, n3, n4, n5) Output(Sum, Average, Standard Deviation)
4, 5, 3, 7, 9 28.000000, 5.600000, 2.408319
4, -2, 8, -4, 3 9.000000, 1.800000, 4.816638

Try it yourself

Try to solve this question on your own in the code widget below. If you get stuck, you can always refer to the solution provided.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.