In statistics, regression analysis is a statistical process for estimating the relationships among variables. It includes many techniques for modelling and analyzing several variables, when the focus is on the relationship between a dependent variable and one or more independent variables.
#include<conio.h> #include<math.h> #include<stdio.h> void main() { float x[50],y[50],y1,a,b,flag1=0,flag2=0,meanx,meany,sum=0,sum1=0; int i,n; clrscr(); printf("Enter the values of n :- "); scanf("%d",&n); printf("Enter the values of x :- \n"); for(i=1;i<=n;i++) { scanf("%f",&x[i]); flag1=flag1+x[i]; } printf("Enter the values of y :- \n"); for(i=1;i<=n;i++) { scanf("%f",&y[i]); flag2=flag2+y[i]; } meanx=flag1/n; meany=flag2/n; for(i=1;i<=n;i++) { sum=sum+(x[i]-meanx)*(y[i]-meany); sum1=sum1+(x[i]-meanx)*(x[i]-meanx); } a=sum/sum1; b=meany-a*meanx; printf("/nRegression Equation Y = (%f)X + %f",a,b); getch(); }