Get Email Subscription

Enter your email address:

Delivered by FeedBurner

Sunday, April 4, 2010

To find and print the regression coefficient.

The Twilight Saga: New Moon (Two-Disc Special Edition)
Write a program in C to input 25 pair of x & y and calculate and print the regression coefficient (b).


#include<stdio.h>
#include<conio.h>
#include<math.h>

#define N 25
void main( )
{
int i, x, y;
float sx=0, sy=0, sxy=0, syy=0, a, b, c;
clrscr( );
for(i=1; i<=N; i++)
{
printf("Input values of x & y pairwise\n");
scanf("%d %d", &x, &y);
sx = sx + x;
sy = sy + y;
sxy = sxy + x * y;
syy = syy + y * y;
}
a = N*sxy - sx*sy;
c = N*syy - sy*sy;
b = a/c;
printf("\n The regression coefficient is %f\n", b);
}

Related Posts by Categories



0 comments:

About This Blog

Lorem Ipsum

  © Blogger templates Newspaper III by Ourblogtemplates.com 2008

Back to TOP