import java.util.Scanner; public class Demo_1{ public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter x1 and y1: "); System.out.print("Enter x2 and y2: "); double b=input.nextDouble(); double d=input.nextDouble(); double a=input.nextDouble(); double c=input.nextDouble(); double y= (b-a)*(b-a)+(d-c)*(d-c); double distance = Math.pow(y, 0.5); System.out.print("The distance the two points is " + distance); } }
时间: 2024-10-04 08:46:12