1. 程式人生 > >2.15 兩點間距離

2.15 兩點間距離

new enter ring point tween void sta port n)

import java.util.Scanner;
  public class Jisuanjl{
  public static void main(String[] args){
    Scanner input=new Scanner(System.in);
    System.out.print("Enter x1 and y1:");
    double x1=input.nextDouble();
    double y1=input.nextDouble();
    Scanner input1=new Scanner(System.in);
    System.out.print("Enter x2 and y2:");
    double x2=input1.nextDouble();
    double y2=input1.nextDouble();
    double l=Math.sqrt(Math.pow((x2-x1),2)+Math.pow((y2-y1),2));
    System.out.println("The distance between the two point is "+l);

  }
}

2.15 兩點間距離