QBasic Programming

Display perimeter of rectangle

REM PROGRAM TO DISPLAY PERIMETER OF RECTANGLE
CLS
INPUT “ENTER LENGTH”; L
INPUT “ENTER BREADTH”; B
P = 2 * (L + B)
PRINT “PERIMETER OF RECTANGLE ”; P
END

USING SUB PROCEDURE

DECLARE SUB PERIMETER (L, B)
CLS
INPUT “ENTER LENGTH”; L
INPUT “ENTER BREADTH”; B
CALL PERIMETER(L, B)
END

SUB PERIMETER (L, B)
P = 2 * (L + B)
PRINT “PERIMETER OF RECTANGLE ”; P
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION PERIMETER (L, B)
CLS
INPUT “ENTER LENGTH”; L
INPUT “ENTER BREADTH”; B
PR = PERIMETER(L, B)
PRINT “PERIMETER OF RECTANGLE ”; PR
END

FUNCTION PERIMETER (L, B)
P = 2 * (L + B)
PERIMETER = P
END FUNCTION

Display area of circle (Prev Lesson)
(Next Lesson) Display perimeter of square
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!