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 System.out.print("Can edges " + side1 + " , " + side2 + " and " + side3 + " from a triangle? "); 17 18 if(side1 + side2 > side3 && side1 + side3 > side2 && side2 + side3 > side1) 19 System.out.println("true"); 20 else 21 System.out.println("false"); 22 } 23 }
时间: 2024-11-09 02:29:01