Find area and perimeter of rectangle

Q. Write a PL/SQL block to calculate area and perimeter of Rectangle.

Answer:

Formula for perimeter of a Rectangle:
I) Perimeter of Rectangle = 2*(L+W)
ii) Area of Rectangle = L*W

The above formula is used in the following program to calculate the area of and preimeter of rectangle.

DECLARE LENGTH number:=&LENGTH;
Width number:=&width;
Area number;
Parimeter number;
BEGIN Area:=LENGTH*width;
Parimeter:= 2*(LENGTH+width);
dbms_output.put_line('AREA OF RECTANGLE IS:'||Area);
dbms_output.put_line('PARIMETER OF RECTANGLE IS:'||PARIMETER);
END;
/


Output:

perimeter of rectangle