QBasic Programming

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

Display circumference of circle (Prev Lesson)
(Next Lesson) Display area and perimeter of square
Back to QBasic Programming
Notice: compact(): Undefined variable: limits in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

Notice: compact(): Undefined variable: groupby in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!