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.
1
Expert's answer
2016-09-30T14:32:03-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS