Get Email Subscription

Enter your email address:

Delivered by FeedBurner

Saturday, April 3, 2010

To find and print mean and mean deviation.

The Big Short: Inside the Doomsday Machinewrite a program in C to input 15 observations and then find and print mean and mean deviation from mean where, mean = SX/15 and mean deviation from mean = S |X-mean| / 15.



#include<stdio.h>
#include<conio.h>
#include<math.h>
void main( )
{
int a, x[15];

float tot=0, mdt=0, d, m, md;
printf("Input 15 values of x, one at a time\n");
for(a=0; a<15; a++)
{
scanf("%d", &x[a]);
tot = tot+x[a];
}
m = tot / 15;
for(a=0; a<15; a++)
{
d = x[a] - m;
if (d < 0 )
d = -d;
mdt = mdt + d;

}
md = mdt / 15;
printf("\n Mean = %f\n", m);
printf("Mean deviation = %f\n", md);
}

The Big Short: Inside the Doomsday Machine

Related Posts by Categories



0 comments:

About This Blog

Lorem Ipsum

  © Blogger templates Newspaper III by Ourblogtemplates.com 2008

Back to TOP