QBASIC PROGRAM TO CALCULATE POTENTIAL ENERGY
CLS
INPUT “ ENTER MASS”; M
INPUT “ENTER HEIGHT”; H
P = M * 9.8 * H
PRINT “POTENTIAL ENERGY OF BODY”; P
END
USING SUB
DECLARE SUB PE(M,H)
CLS
INPUT “ ENTER MASS”; M
INPUT “ENTER HEIGHT”; H
CALL PE(M,H)
END
SUB PE(M,H)
P = M * 9.8 * H
PRINT “POTENTIAL ENERGY OF BODY”; P
END SUB
0 Comments