Computer Science, asked by vsdokare, 4 months ago

Write a C program that accepts coordinates of two-dimensional points A and B and
prints out (using two decimal places) the distance between A and B. It also prints out the
coordinates (using two decimal places) of the midpoint of A and B.​

Answers

Answered by pratibhakumariprusty
0

Answer:

Know Program

Main Menu

C Program to Find the Distance Between Two Points

C Program, C Programming / Leave a Comment

Program description:- Write a C program to find the distance between two given points.

The distance formula is derived from the Pythagorean theorem. To find the distance between two points (x1, y1) and (x2, y2), all that you need to do is use the coordinates of these ordered pairs and apply the formula.

Distance Formula

Assume we have two points M and N, with coordinates (x1, y1) and (x2, y2) respectively. Their distance can be represented as MN and it can be calculated as given below formula,

The first point (M):- (x1, y1)

Second point (N):- (x2, y2)

Distance (MN):- √((x2-x1)2 + (y2-y1)2)

Example:-

M = (4, 8)

N = (12, 14)

Then distance between M and N is, MN = √((12-4)2 + (14-8)2) = √(64 + 36) = √(100) = 10

Similar questions