# Answer to Question #62288 in C++ for jamal

Question #62288

Write a program that takes as input five numbers and find the mean (average) and standard deviation of the numbers.

Expert's answer

#include <iostream>

#include <math.h>

using std::cout;

using std::cin;

using std::endl;

int main()

{

int i1, i2, i3, i4, i5, mean;

cout << "Enter the numbers: ";

cin >> i1 >> i2 >> i3 >> i4 >> i5;

mean = (i1 + i2 + i3 + i4 + i5)/5;

cout << "Mean = " << mean << endl;

cout << "Standard deviation = ";

cout << sqrt((pow(i1 - mean, 2) + pow(i2 - mean, 2) + \

pow(i3 - mean, 2) + pow(i4 - mean, 2) + pow(i5 - mean, 2))/5);

cout << endl;

return 0;

}

#include <math.h>

using std::cout;

using std::cin;

using std::endl;

int main()

{

int i1, i2, i3, i4, i5, mean;

cout << "Enter the numbers: ";

cin >> i1 >> i2 >> i3 >> i4 >> i5;

mean = (i1 + i2 + i3 + i4 + i5)/5;

cout << "Mean = " << mean << endl;

cout << "Standard deviation = ";

cout << sqrt((pow(i1 - mean, 2) + pow(i2 - mean, 2) + \

pow(i3 - mean, 2) + pow(i4 - mean, 2) + pow(i5 - mean, 2))/5);

cout << endl;

return 0;

}

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment