Scheme coding Write a program in Scheme that will compute the population standar
ID: 3574069 • Letter: S
Question
Scheme coding
Write a program in Scheme that will compute the population standard deviation of a list of numbers. Standard deviation is calculated by computing the squareroot of the sum of the squares of the difference between each number and the average, divided by the number of numbers on the list. You may use additional expressions to make your program easier to write and write. For additional details on computing population standard deviation, see this link. E.g. with numbers 1, 2, 3, 4, 5, the population average is 3. The population standard deviation is then computed as Squareroot (1 - 3)^2 + (2 - 3)^2 + (3 - 3)^2 + (4 - 3)^2 + (5 - 3)^2 = Squareroot 2/5Explanation / Answer
program:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int i,elements;
float population[5];
float variance sum=0,mean,variance,sum=0,sd,difference;
printf("/n enter the elements in population:");
for(i=0;i<5;i++)
{
scanf("%f",&population[i]);
}
for(i=0;i<5;i++)
{
sum=sum+population[i];
}
mean=sum/elements;
for(i=0;i<5;i++)
{
difference=population[i]-mean;
variance sum=variance sum+pow(difference,2);
}
variance=variance sum/elements;
sd=sqrt(variance);
printf("the mean is: %f,mean);
printf("the variance is : %f,variance);
printf("standard deviation is : %.13f ,sd);
}
output :
enter the elements in the population :
20 25 34 39 12
the mean is 26.
the variance is 104.4
the standard deviation is 10.21763181955584
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.