5,点距

 1 //程序员:马相露
 2 package demo;
 3 import java.util.Scanner;
 4 public class Ly {
 5 
 6   public static void main(String[] args) {
 7     Scanner input = new Scanner(System.in);
 8 
 9     System.out.print("输入x1和y1:"); 
10     double x1 =input.nextDouble(); 
11     double y1 =input.nextDouble(); 
12 
13     System.out.print("输入x2和y2:"); 
14     double x2 =input.nextDouble(); 
15     double y2 =input.nextDouble(); 
16 
17     double x =Math.pow((x2 - x1),2);
18     double y =Math.pow((y2 - y1),2);
19     System.out.println("两个点之间的距离是:"+ Math.pow((x+y),0.5));
20   }
21 }

 

posted @ 2017-12-18 14:15  mxl-1  阅读(109)  评论(0编辑  收藏  举报