Saturday, October 22, 2016

Qbasic Program: Calculate Simple Interest



46. 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





47. 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








48. 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
49. 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



50. 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

7 comments:

  1. Best way to learn modular programming for class 10.

    ReplyDelete
  2. Thanks for breaking down the concept of simple interest! It’s a crucial skill for anyone managing loans or savings. I appreciate the clear examples provided! And just as a good financial plan is essential, choosing a dependable host like tso Host can ensure your website runs smoothly!

    ReplyDelete