Write a program that takes as input five numbers and outputs the mean (average)
ID: 3930270 • Letter: W
Question
Write a program that takes as input five numbers and outputs the mean (average) and standard deviation of the numbers. If the numbers are x1,x2,x3,x4, and x5, then the mean is x = (x1+x2+x3+x4+x5)/5 and the standard deviation is: Image result for standard deviation formula Please let N =5 be the termination The program must contain at least the following functions: a function that calculates and returns the mean and a function that calculates the standard deviation.
Please use C++ Visual Studio 2013 for this problem
Explanation / Answer
#include<iostream.h>
#include<stdio.h>
void main()
{
int sum = 0;
int calculateMean(int s);
for(i=0;i<5;i++)
{
cout<<"Please enter the numbers";
cin>>n;
arr[i]=n;
sum = sum+arr[i];
}
mean = calculateMean(sum);
cout<<"Mean of entered numbers is"<<mean<<endl;
}
int calculateMean(int s)
{
int mean;
mean = sum/5;
return mean;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.