QBasic Programming

Input amount, rate, time and display principal

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

USING FUNCTION PROCEDURE

DECLARE FUNCTION PRINCIPAL (A, T, R)
CLS
INPUT “ENTER AMOUNT”; A
INPUT “ENTER TIME”; T
INPUT “ENTER RATE”;R
PRINT “PRINCIPAL AMOUNT=”; PRINCIPAL(A, T, R)
END

FUNCTION PRINCIPAL (A, T, R)
P = (100 * A) / (R * T + 100)
PRINCIPAL = P
END FUNCTION

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

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!