已知两点坐标分别为a(x1,y1),b(x2,y2),计算两点间的距离d(结果保留两位小数)。
输入格式:依次输入四个正整数 x1,x2,y1,y2
ps:需要使用sqrt函数和pow函数,头文件加math.h
输入样例:
3 5 7 8
输出样例:
5.00
#include<stdio.h>
#include<math.h>
int main()
{
double x1,y1,x2,y2,d;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
d=sqrt(pow(x1-x2,2)+pow(y1-y2,2));
printf("%.2lf",d);
return 0;
}