Answers for "calculate distance between 2 points X Y axis"

C
0

calculate distance between 2 points X Y axis

#include <stdio.h>
#include <math.h>
	//math.h library for square root and power functions
	//uses pythagorean theorem of triangles to calculate distance

float Distance(float x1, float y1, float x2, float y2)
{
    return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
}
Posted by: Guest on May-03-2022

Code answers related to "calculate distance between 2 points X Y axis"

Code answers related to "C"

Browse Popular Code Answers by Language