write a programm to enter the length and width of a rectangle .Display the area and perimeter of the rectangle.
Answers
Answered by
2
Answer:
//program for area and perimeter
public class Rectangle
{
public static void main(int l, int b)
{ System.out.println("length="+l);
System.out.println("breadth="+b);
int a=l*b;
System.out.println("area="+a);
int p=2*(l+b);
System.out.println("perimeter="+p);
}
}
This is the normal method, but you can also use switch case for making it easier. (if you know)
Hope you understood!!!
Similar questions