已知两点A(x1,y1)
,B(x2,y2)
,求其间的距离。
输入 一行四个浮点数,x1,y1,x2,y2
输出 两点间的距离,要求不要输出多余的零。
#include <stdio.h>
#include <math.h>
int main()
{
double x1,y1;
double x2,y2;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
double l;
l=sqrt(pow((y2-y1),2)+pow((x2-x1),2));
printf("%g",l);
return 0;
}