Computer Science, asked by ayesha170, 1 year ago

calculate the area and perimeter of rectangle java


rawatrishabh03: do you mean a program to calculate area and perimeter of rectangle?

Answers

Answered by shanghvi0oybonp
2
Java Program To Calculate Area And Perimeter Of Rectangle

To find the area of rectangle we multiply it's Length and Width.

Area of Rectangle = L X W.

Perimeter of Rectangle = 2 X (L + W).

L is the length of longer side of rectangle.

W is the length of smaller side of rectangle.


rawatrishabh03: Bro! Do you even know how to make a java program.
shanghvi0oybonp: no
Answered by rawatrishabh03
12
import java.util.*;
class AreaPerimeter
{
public static void main()
{
Scanner sc = new Scanner(System.in);
int L,B;
double area,perimeter;
System.out.println("Enter length and breadth of rectangle");
L = sc.nextInt();
B = sc.nextInt();
area = L * B;
perimeter = 2(L + B);
System.out.println("Area is " + area);
System.out.println("Perimeter is " + perimeter);
}
}

Hope it helps plz mark me as brainliest
Similar questions