C write function distance that calculates the distance between two points (x1, y1) and (x2, y2). all numbers and return values should be of type double.

Respuesta :

Your question is unclear but here is my try.

Given (0, 5) and (5, 0), find the distance between the two points.

Let (0, 5) and (5, 0) be the two points.

Let d = distance

d = sqrt{(5 - 0)^2 + (0 - 5)^2}

d = sqrt{(5)^2 + (-5)^2}

d = sqrt{25 + 25}

d = sqrt{50}

d = sqrt{25}•sqrt{2}

d = 5•sqrt{2}