📜  求矩形周长的java程序 - Java代码示例

📅  最后修改于: 2022-03-11 14:52:31.038000             🧑  作者: Mango

代码示例1
Scanner sc = new Scanner(System.in);
System.out.println("Enter Width of the rectangle: ");
double width = sc.nextDouble();
System.out.println("Enter Height of the rectangle: ");
double height = sc.nextDouble();
sc.close();
// Logic for finding the perimeter of the rectangle
double perimeter = 2 * (width + height);
System.out.println("Perimeter of Rectangle: " + perimeter);