QBasic Programming

Input principal, rate, time and display simple interest and total amount

CLS
INPUT “ENTER PRINCIPAL”; P
INPUT “ENTER TIME”; T
INPUT “ENTER RATE”;R
I = P* T * R / 100
A = P + I
PRINT “SIMPLE INTEREST=”;I
PRINT “TOTAL AMOUNT=”; A
END
USING SUB PROCEDURE
DECLARE SUB INTEREST (P, T, R)
DECLARE SUB AMOUNT (P)
COMMON SHARED I
CLS
INPUT “ENTER PRINCIPAL, TIME, RATE”; P, T, R
CALL AMOUNT(P)
CALL INTEREST(P, T, R)
END
SUB INTEREST (P, T, R)
I = P* T * R / 100
PRINT “SIMPLE INTEREST =”; I
END SUB
SUB AMOUNT (P)
A = P + I
PRINT “TOTAL AMOUNT=”; A
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION INTEREST (P, T, R)
DECLARE FUNCTION AMOUNT (P)
COMMON SHARED I
CLS
INPUT “ENTER PRINCIPAL, TIME, RATE”; P, T, R
PRINT “SIMPLE INTEREST =”; INTEREST(P, T, R)
PRINT “TOTAL AMOUNT=”; AMOUNT(P)
END
FUNCTION INTEREST (P, T, R)
I = P* T * R / 100
INTEREST = I
END FUNCTION
FUNCTION AMOUNT (P)
A = P + I
AMOUNT = A : END FUNCTION

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

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!