write a program to find area of a rectangle in Java
Answers
Answered by
3
Explanation:
import java.util.Scanner;
public class Area_Perimeter
{
public static void main(String[] args)
{
int l, b, perimeter, area;
Scanner s = new Scanner(System.in);
System.out.print("Enter length of rectangle:");
l = s.nextInt();
System.out.print("Enter breadth of rectangle:");
b = s.nextInt();
perimeter = 2 * (l + b);
System.out.println("Perimeter of rectangle:"+perimeter);
area = l * b;
System.out.println("Area of rectangle:"+area);
}
}
Similar questions