Computer Science, asked by trinabhattacharjee, 3 months ago

write a program enter length and breadth of a rectangle find area and perimeter from Qbasic.

Answers

Answered by Anonymous
6

Display area and perimeter of rectangle.

REM PROGRAM TO DISPLAY AREA AND PERIMETER OF RECTANGLE

CLS

INPUT “ENTER LENGTH”; L

INPUT “ENTER BREADTH”; B

A= L * B

P = 2 * (L + B)

PRINT “AREA OF RECTANGLE “; A

PRINT “PERIMETER OF RECTANGLE ”; P

END

USING SUB PROCEDURE

DECLARE SUB AREA (L, B)

DECLARE SUB PERIMETER (L, B)

CLS

INPUT “ENTER LENGTH”; L

INPUT “ENTER BREADTH”; B

CALL AREA (L, B)

CALL PERIMETER(L, B)

END

SUB AREA (L, B)

A = L * B

PRINT “AREA OF RECTANGLE ”; A

END SUB

SUB PERIMETER (L, B)

P = 2 * (L + B)

PRINT “PERIMETER OF RECTANGLE ”; P

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION AREA (L, B)

DECLARE FUNCTION PERIMETER (L, B)

CLS

INPUT “ENTER LENGTH”; L

INPUT “ENTER BREADTH”; B

AR = AREA(L, B)

PR = PERIMETER(L, B)

PRINT “AREA OF RECTANGLE”; AR

PRINT “PERIMETER OF RECTANGLE ”; PR

END

FUNCTION AREA (L, B)

A = L * B

AREA = A

END FUNCTION

FUNCTION PERIMETER (L, B)

P = 2 * (L + B)

PERIMETER = P

END FUNCTION

Similar questions