/* program to find the location of the origin (0,0) with respect to the line joining the two points. * Author: rahule@icse.iitk.ac.in * * Created on 14 August, 2010, 1:02 AM */ #include int main() { double x1,x2,y1,y2,a,b; printf("\nEnter the coordinates of two points\n"); scanf("%lf%lf%lf%lf",&x1,&x2,&y1,&y2); a=(y2-y1)/(x2-x1); //finding a,b where y=ax+b is the equation of the line b=y1-x1*(y2-y1)/(x2-x1); if(b>0) //origin is bellow the line { if((-b)/a>0) //origin is in the left side of the line printf("lb"); else //origin is in the right side of the line printf("rb"); } else //origin above the line { if((-b)/a>0) printf("la"); //origin is in the left side of the line else printf("ra"); //origin is in the right side of the line } }