HW3.25

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");
     }
 }
上一篇:pipe row的用法, Oracle split 函数写法.


下一篇:洗礼灵魂,修炼python(43)--巩固篇—经典类/新式类