码迷,mamicode.com
首页 > 其他好文 > 详细

HW2.20

时间:2016-08-08 21:09:12      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

技术分享

 

 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 }

 

HW2.20

标签:

原文地址:http://www.cnblogs.com/wood-python/p/5750805.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!