标签:
1 import java.util.Scanner; 2 3 public class Solution 4 { 5 public static void main(String[] args) 6 { 7 Scanner input = new Scanner(System.in); 8 9 System.out.print("Enter x1 and y1: "); 10 double x1 = input.nextDouble(); 11 double y1 = input.nextDouble(); 12 13 System.out.print("Enter x2 and y2: "); 14 double x2 = input.nextDouble(); 15 double y2 = input.nextDouble(); 16 17 input.close(); 18 19 double distanceSquare = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); 20 double distance = Math.pow(distanceSquare, 0.5); 21 22 System.out.println("The distance of the two points is " + distance); 23 } 24 }
标签:
原文地址:http://www.cnblogs.com/wood-python/p/5750805.html