QBasic Programming

calculate profit

REM PROGRAM TO CALCULATE PROFIT
CLS
INPUT “ENTER COST PRICE”; CP
INPUT “ENTER SELLING PRICE”; SP
P = SP - CP
PRINT “PROFIT AMOUNT=”; P
END

USING SUB PROCEDURE

DECLARE SUB PROFIT (CP, SP)
CLS
INPUT “ENTER COST PRICE”; CP
INPUT “ENTER SELLING PRICE”; SP
CALL PROFIT(CP, SP)
END

SUB PROFIT(CP, SP)
P = SP - CP
PRINT “PROFIT AMOUNT=”; P
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION PROFIT (CP, SP)
CLS
INPUT “ENTER COST PRICE”; CP
INPUT “ENTER SELLING PRICE”; SP
PRINT “PROFIT AMOUNT=”; PROFIT(CP, SP)
END

FUNCTION PROFIT(CP, SP)
P = SP – CP
PROFIT = P
END FUNCTION

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

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!