QBasic Programming

Input principal, rate, time and display total amount

REM PROGRAM TO DISPLAY TOTAL AMOUNT
CLS
INPUT “ENTER PRINCIPAL”; P
INPUT “ENTER TIME”; T
INPUT “ENTER RATE”;R
I = P* T * R / 100
A = P + I
PRINT “TOTAL AMOUNT=”; A
END
USING SUB PROCEDURE
DECLARE SUB AMOUNT (P, T, R)
CLS
INPUT “ENTER PRINCIPAL”; P
INPUT “ENTER TIME”; T
INPUT “ENTER RATE”;R
CALL AMOUNT(P, T, R)
END
SUB AMOUNT (P, T, R)
I = P* T * R / 100
A = P + I
PRINT “TOTAL AMOUNT=”; A
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION AMOUNT (P, T, R)
CLS
INPUT “ENTER PRINCIPAL”; P
INPUT “ENTER TIME”; T
INPUT “ENTER RATE”;R
PRINT “TOTAL AMOUNT=”; AMOUNT(P, T, R)
END
FUNCTION AMOUNT (P, T, R)
I = P* T * R / 100
A = P + I
AMOUNT = A
END FUNCTION

Display simple interest (Prev Lesson)
(Next Lesson) Input principal, rate, time and display simple interest and total amount
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!