Write a java program to enter the area and length of rectangle and calculate its breadth and perimeter
Answers
Step-by-step explanation:import java.util.*;
public class JavaAreaAndPerimeterOfRectangle {
public static void main(String args[]) {
int length, width, area, perimeter;
Scanner in = new Scanner(System.in);
System.out.println("Enter length of Rectangle");
length = in.nextInt();
System.out.println("Enter width of Rectangle");
width = in.nextInt();
// Area of rectangle = length X width
area = length * width;
// Perimeter of rectangle = 2 X (length X width)
perimeter = 2 * (length + width);
System.out.println("Area of Rectangle : " + area);
System.out.println("Rectangle of Rectangle : " + perimeter);
}
}
import java.util.*;
public class Breadth _Perimeter
{
public static void main(String args[])
{
Scanner in =new Scanner(System.in);
float a,l,b,p;
System.out.println("Enter the area and length");
a=in.nextFloat();
l=in.nextFloat();
b=a/l;
p=2*(l+b);
System.out.println("The breadth is"+b);
System.out.println("The perimeter is"+p);
}
}