Hey guys!! Welcome to flower brackets blog. In this post we are going to learn program to calculate perimeter of rectangle in java.

#### Program to calculate perimeter of rectangle in java

First input length and width of rectangle from user. Next apply perimeter formula, perimeter = 2 * (length + width). Lastly print the perimeter value.

Also Read – Rectangle Java Program

Here’s the java program to find perimeter of rectangle,

import java.util.Scanner;

public class PerimeterOfRectangleDemo

{

public static void main(String []args)

{

float length, width, perimeter;

Scanner sc = new Scanner(System.in);

System.out.print("Enter length of rectangle : ");

length = sc.nextFloat();

System.out.print("Enter width of rectangle : ");

width = sc.nextFloat();

perimeter = 2 * (length + width);

System.out.println("Perimeter of rectangle : " + perimeter);

sc.close();

}

}

**Output:**

Enter length of rectangle : 2

Enter width of rectangle : 5

Perimeter of rectangle : 14.0