Enter the width and height of a rectangle from the user calculate the perimeter and area (in Qbasic)
Answers
Answer:
Display area of rectangle.
REM PROGRAM TO DISPLAY AREA OF RECTANGLE
CLS
INPUT “ENTER LENGTH”; L
INPUT “ENTER BREADTH”; B
A = L * B
PRINT “AREA OF RECTANGLE ”; A
END
USING SUB PROCEDURE
DECLARE SUB AREA (L, B)
CLS
INPUT “ENTER LENGTH”; L
INPUT “ENTER BREADTH”; B
CALL AREA(L, B)
END
SUB AREA (L, B)
A = L * B
PRINT “AREA OF RECTANGLE ”; A
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION AREA (L, B)
CLS
INPUT “ENTER LENGTH”; L
INPUT “ENTER BREADTH”; B
AR = AREA(L, B)
PRINT “AREA OF RECTANGLE ”; AR
END
FUNCTION AREA (L, B)
A = L * B
AREA = A
END FUNCTION
16. Display area of square.
REM PROGRAM TO DISPLAY AREA OF SQUARE
CLS
INPUT “ENTER LENGTH”; L
A = L ^ 2
PRINT “AREA OF SQUARE ”; A
END
USING SUB PROCEDURE
DECLARE SUB AREA (L)
CLS
INPUT “ENTER LENGTH”; L
CALL AREA(L)
END
SUB AREA (L)
A = L ^ 2
PRINT “AREA OF SQUARE”; A
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION AREA (L)
CLS
INPUT “ENTER LENGTH”; L
AR = AREA(L)
PRINT “AREA OF SQUARE ”; AR
END
FUNCTION AREA (L)
A = L ^ 2
AREA = A
END FUNCTION
Explanation: Please mark me braonliest