C Program to find distance between two straight lines
Program
#include<stdio.h>
#include<math.h>
void main()
{
int x1, x2, y1, y2;
int s1, s2, distance;
printf("Enter two values for line 1:\n");
scanf("%d %d", &x1, &x2);
printf("Enter two values for line 2:\n");
scanf("%d %d", &y1, &y2);
s1 = x2 - x1;
s2 = y2 - y1;
distance = sqrt(pow(s1,2) + pow(s2,2));
printf("Distance between two lines is:\t%d\n", distance);
}
Output
Enter two values for line 1:
78
65
Enter two values for line 2:
54
39
Distance between two lines is: 19