Problem Statement
Write a function float distance(float x1, float y1, float x2, float y2) that returns the Euclidean distance between two points (x1, y1) and (x2, y2).
Formula: sqrt((x2-x1)^2 + (y2-y1)^2).
DEMO-C-32 โข Programming in C
Write a function float distance(float x1, float y1, float x2, float y2) that returns the Euclidean distance between two points (x1, y1) and (x2, y2).
Formula: sqrt((x2-x1)^2 + (y2-y1)^2).
Four floats.
Distance value.
Submit runs every public testcase in this browser. Results and code never leave this device.
0.0 0.0 3.0 4.0
5.000000
-1.0 -1.0 -1.0 -1.0
0.000000
0.0 0.0 0.0 10.0
10.000000
C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.
/workspace/question