calculate the area and perimeter of rectangle java
rawatrishabh03:
do you mean a program to calculate area and perimeter of rectangle?
Answers
Answered by
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.
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.
Answered by
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
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