60 736
Assignments Done
Successfully Done
In April 2018

Answer to Question #16374 in C++ for Phillip

Question #16374
Write a program that takes as input three numbers and outputs the mean (average) and standard deviation of the numbers. If the numbers are x1, x2, and x3, then the mean(average) is x=(x1+x2+x3)/3 and the standard deviation is :

Your program must contain at least the following functions: a function that calculates and returns the mean and a function that calculates the standard deviation.
Expert's answer
#include <iostream>
#include <cmath>

using namespace std;
float numberOne;
float numberTwo;
float numberThree;
float mean;
float standardDeviation;
float calulatemean(){
mean = (numberOne + numberTwo + numberThree) / 4;
return mean;
float calculatestandarddeviation(){
standardDeviation = sqrt((pow(numberOne-mean,2)) + (pow(numberTwo-mean,2)) +

(pow(numberThree-mean,2))/ 3);
return standardDeviation;

int main ()
cout << "Input your first number :" ;
cin >> numberOne;
cout << "Input your second number:" ;
cin >> numberTwo;
cout << "Input your third number :" ;
cin >> numberThree;

cout << "The mean is " << mean << " and the standard deviation is " << calculatestandarddeviation() << "."
<< endl;
int k;
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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions