Sunteți pe pagina 1din 1

/* Program to input two coordinate points in a 2-D plane and obtain the equation

of the line pasing through them */


#include<stdio.h>
void main()
{
float x1,x2,y1,y2,slope,intercept;
clrscr();
printf("Enter the x and y coordinates of the first point:");
scanf("%f%f",&x1,&y1);
printf("Enter the x and y coordinates of the second point:");
scanf("%f%f",&x2,&y2);
slope=(y1-y2)/(x1-x2);
intercept=y1-slope*x1;
printf("\nThe equation of the required straight line is\ny=%fx+%f",slope,inter
cept);
getch();
}

S-ar putea să vă placă și