#include<stdio.h> #include<math.h> double dist(double x1,double y1,double x2,double y2) { double s; s=sqrt(pow((x2-x1),2)+pow((y2-y1),2)); return s; } intmain() { double x1,y1,x2,y2,s; scanf("%lf%lf",&x1,&y1); scanf("%lf%lf",&x2,&y2); s=dist(x1,y1,x2,y2); printf("%.2lf",s); return 0; }
Calculate the distance between two points using a function
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=325590210&siteId=291194637
Recommended
Ranking