Java Program to Calculate Area and Perimeter of Rectangle

The area and perimeter of a rectangle can be calculated using the formula Area = length * width and Perimeter = 2 * (length + width). Here is the program to implement this in Java. First, we take length and breadth from the user as input and then give area and perimeter as output.

Area of Rectangle

Output:

Enter rectangle length: 10
Enter rectangle width: 5
Area: 50.0

Perimeter of Rectangle

Output:

Enter rectangle length: 10
Enter rectangle width: 5
Perimeter: 30.0

Leave a Comment

Your email address will not be published. Required fields are marked *