QBasic Programming

Display simple interest

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

USING SUB PROCEDURE

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

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

USING FUNCTION PROCEDURE

DECLARE FUNCTION INTEREST (P, T, R)
CLS
INPUT “ENTER PRINCIPAL”; P
INPUT “ENTER TIME”; T
INPUT “ENTER RATE”;R
PRINT “SIMPLE INTEREST=”; INTEREST(P, T, R)
END

FUNCTION INTEREST (P, T, R)
I = P* T * R / 100
INTEREST = I
END FUNCTION

Display total surface area and volume of cube (Prev Lesson)
(Next Lesson) Input principal, rate, time and display total amount
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!