Write a program in QBasic to calculate area and perimeter
of square
Answers
Answered by
0
Answer:
Explanation:
QBASIC PROGRAM TO FIND PERIMETER OF A SQUARE USING SUB AND FUNCTION
Solution
Display perimeter of a square.
REM PROGRAM TO DISPLAY PERIMETER OF SQUARE
CLS
INPUT “ENTER LENGTH”; L
P = 4 * L
PRINT “PERIMETER OF SQUARE ”; P
END
FIND PERIMETER OF A SQUARE USING SUB PROCEDURE
DECLARE SUB PERIMETER (L)
CLS
INPUT “ENTER LENGTH”; L
CALL PERIMETER (L)
END
SUB PERIMETER (L)
P = 4 * L
PRINT “PERIMETER OF SQUARE”; P
END SUB
FIND PERIMETER OF A SQUARE USING FUNCTION PROCEDURE
DECLARE FUNCTION PERIMETER (L)
CLS
INPUT “ENTER LENGTH”; L
PR = PERIMETER (L)
PRINT “PERIMETER OF SQUARE ”; PR
END
FUNCTION PERIMETER (L)
P = 4 * L
PERIMETER = P
END FUNCTION
Similar questions
Math,
3 hours ago
Computer Science,
3 hours ago
Hindi,
3 hours ago
Chemistry,
5 hours ago
Math,
8 months ago
India Languages,
8 months ago