标签:
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 }
标签:
原文地址:http://www.cnblogs.com/wood-python/p/5767286.html