Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Breaking

Post Top Ad

Your Ad Spot

Saturday, December 3, 2022

QBASIC program to calculate and display the simple interest

 QBASIC program to calculate and display the simple interest


CLS

INPUT "Enter Principal amount:"; p

INPUT "Enter time:"; t

INPUT "Enter rate of interest:"; r

si = p * t * r / 100

PRINT "Simple interest="; si

END

 

By using SUB procedure (SUB..END SUB)

DECLARE SUB si (p, t, r)

CLS

INPUT "Enter Principal amount:"; p

INPUT "Enter time:"; t

INPUT "Enter rate of interest:"; r

CALL si(p, t, r)

END

 

SUB si (p, t, r)

i = p * t * r / 100

PRINT "Simple interest="; i

END SUB

 

By using FUNCTION procedure (FUNCTION…END FUNCTION)

DECLARE FUNCTION si (p, t, r)

CLS

INPUT "Enter Principal amount:"; p

INPUT "Enter time:"; t

INPUT "Enter rate of interest:"; r

i = si(p, t, r)

PRINT "Simple interest="; i

END

 

FUNCTION si (p, t, r)

si = p * t * r / 100

END FUNCTION


Output:



No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages