HW3.25

时间:2022-09-18 22:18:10

HW3.25

 import java.util.Scanner;

 public class Solution
 {
     public static void main(String[] args)
     {
         Scanner input = new Scanner(System.in);

         System.out.print("Enter three edges: ");
         double side1 = input.nextDouble();
         double side2 = input.nextDouble();
         double side3 = input.nextDouble();

         input.close();

         if(side1 + side2 > side3 && side1 + side3 > side2 && side2 + side3 > side1)
         {
             double perimeter = side1 + side2 + side3;
             System.out.println("The perimeter of the triangle is " + perimeter);
         }
         else
             System.out.println("The three sides can not be a triangle");
     }
 }

相关文章