Write a java program to enter the perimeter and breadth of rectangle and calculate its length and area
Answers
Answered by
5
import java.util.*;
public class Length_Area
{
public static void main(String args[])
{
Scanner in =new Scanner(System.in);
float a,l,b,p;
System.out.println("Enter the perimeter and breadth");
p=in.nextFloat();
b=in.nextFloat();
l=(p/2)-b;
a=l*b;
System.out.println("The length is"+l);
System.out.println("The area is"+a);
}
}
Similar questions