Go to Top

Wednesday, 9 November 2011

To find the area of a rectangle

Question 67 : Write a program in Java to find the area and perimeter of a rectangle. Length and breadth to be taken as input from the user.

Java Program :

public class rectangle
{
 public static void main(int l,int b)
 {
     int a=0,p=0;
     a=l*b;
     p=2*(l+b);
     System.out.println("Area of the rectangle = "+a+" units");
     System.out.println("Perimeter of the rectangle = "+p+" units");
    }
}

1 comment:

  1. It's good to be here and this program about How to Find Area of a Rectangle is totally helpful for me .Thanks for helping me for this .

    ReplyDelete

ShareThis