Write a PL/SQL program to find area and perimeter of rectangle.
DECLARE
-- Declaration of length and assigning values
l NUMBER(4, 2) := 3;
--Declaration of breadth and assigning values
b NUMBER(4, 2) := 7;
--Declaration of a variable for Area of rectangle
a NUMBER(4, 2);
--Declaration of a variable for perimeter
p NUMBER(4, 2);
BEGIN
-- calculate area and perimeter
a := l * b;
p := 2 * (l + b);
--Display result
dbms_output.Put_line('Area of the rectangle is '
|| a);
dbms_output.Put_line('Perimeter of the rectangle is '
|| p);
END;
--ENd program
Comments
Leave a comment