QBasic Programming

Input simple interest, rate, time and display principal

REM PROGRAM TO INPUT SIMPLE INEREST, RATE AND TIME AND DISPLAY PRINCIPAL
CLS
INPUT “ENTER INTEREST”; I
INPUT “ENTER TIME”; T
INPUT “ENTER RATE”;R
P = (100 * I) / (R * T)
PRINT “PRINCIPAL AMOUNT=”; P
END

USING SUB PROCEDURE

DECLARE SUB PRINCIPAL (I, T, R)
CLS
INPUT “ENTER INTEREST”; I
INPUT “ENTER TIME”; T
INPUT “ENTER RATE”;R
CALL PRINCIPAL(I, T, R)
END

SUB PRINCIPAL (I, T, R)
P = (100 * I) / (R * T)
PRINT “PRINCIPAL AMOUNT=”; P
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION PRINCIPAL (I, T, R)
CLS
INPUT “ENTER INTEREST”; I
INPUT “ENTER TIME”; T
INPUT “ENTER RATE”;R
PRINT “PRINCIPAL AMOUNT=”; PRINCIPAL(I, T, R)
END
FUNCTION PRINCIPAL (I, T, R)
P = (100 * I) / (R * T)
PRINCIPAL = P
END FUNCTION

Input amount, rate, time and display principal (Prev Lesson)
(Next Lesson) calculate profit
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!