#include<stdio.h>
#include<conio.h>
main()
{
int n,count;
float avg,d,sum=0;
float x[100];
printf("\nHow many numbers will be averaged?");
scanf("%d",&n);
printf("\n");
for(count=0;count<n;++count)
{
printf("i = %d x = ",count+1);
scanf("%f",&x[count]);
sum+=x[count];
}
avg=sum/n;
printf("\nThe average is %f\n\n",avg);
for(count=0;count<n;++count)
{
d=x[count]-avg;
printf("i = %d x = %f d = %f\n",count+1,x[count],d);
}
getch();
}
Friday, 4 May 2012
Calculating Deviation in C
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment