C language calculates the distance between two points

ww‮tual.w‬turi.com
C language calculates the distance between two points

Knowing the coordinates of two points, you can calculate the distance between them according to Pythagorean theorem.

// calculate the distance between 2 point in c
#include <stdio.h>
#include <math.h>

float distance = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
Created Time:2017-08-28 07:47:57  Author:lautturi