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

HW3.25

时间:2016-08-13 10:00:27      阅读:164      评论: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 three edges: ");
10         double side1 = input.nextDouble();
11         double side2 = input.nextDouble();
12         double side3 = input.nextDouble();
13 
14         input.close();
15 
16         if(side1 + side2 > side3 && side1 + side3 > side2 && side2 + side3 > side1)
17         {
18             double perimeter = side1 + side2 + side3;
19             System.out.println("The perimeter of the triangle is " + perimeter);
20         }
21         else
22             System.out.println("The three sides can not be a triangle");
23     }
24 }

 

HW3.25

标签:

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

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