wap to calculate and display the distance between two points in a line using the formula-
d= √(x2-x1)^2+(y2-y1)^2
Answers
Answered by
0
Answer:
int main() {
float x1, y1, x2, y2, gdistance;
printf("Input x1: ");
scanf("%f", &x1);
printf("Input y1: ");
scanf("%f", &y1);
printf("Input x2: ");
scanf("%f", &x2);
printf("Input y2: ");
scanf("%f", &y2);
gdistance = ((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1));
printf("Distance between the said points: %.4f", sqrt(gdistance));
printf("\n");
return 0;
}
Similar questions
Math,
1 month ago
Math,
1 month ago
Physics,
3 months ago
History,
3 months ago
Political Science,
9 months ago