Answer:
void distance(int x1, int x2, int y1, int y2){
pointsDistance = sqrt((x2-x1)^(2) + (y2-y1)^(2));
}
Step-by-step explanation:
Suppose we have two points:
[tex]A = (x_{1}, y_{1})[/tex]
[tex]B = (x_{2}, y_{2}[/tex]
The distance between these points is:
[tex]D = \sqrt{(x_{2} - x_{1})^{2} + (y_{2} - y_{1})^{2}}[/tex]
So, for points (1.0, 2.0) and (1.0, 5.0)
[tex]D = \sqrt{(1 - 1)^{2} + (5 - 2)^{2}} = \sqrt{9} = 3[/tex]
I suppose this questions asks me to write a code, since i have to attribute the result to pointsDistance. I am going to write a C code for this, and you have to include the math.h library.
void distance(int x1, int x2, int y1, int y2){
pointsDistance = sqrt((x2-x1)^(2) + (y2-y1)^(2));
}