QBASIC PROGRAM TO CALCULATE PROFIT AND/OR LOSS PERCENT

QBASIC PROGRAM TO CALCULATE PROFIT AND/OR LOSS PERCENT



 CLS
 INPUT “ENTER COST PRICE”; CP
 INPUT “ENTER SELLING PRICE”; SP
 IF CP > SP THEN
 LP = ((CP - SP)/CP) * 100
 PRINT "LOSS PERCENTAGE="; LP
 ELSEIF SP > CP THEN
 PP = ((SP - CP)/CP) * 100
 PRINT "PROFIT PERCENTAGE="; PP
 ELSE
 PRINT "NEITHER PROFIT NOR LOSS"
 END IF
 END

USING SUB


DECLARE SUB PL(CP,SP)
 CLS
 INPUT “ENTER COST PRICE”; CP
 INPUT “ENTER SELLING PRICE”; SP
 CALL PL(CP,SP)
 END
 
 SUB PL(CP,SP)
 IF CP > SP THEN
 LP = ((CP - SP)/CP) * 100
 PRINT "LOSS PERCENTAGE="; LP
 ELSEIF SP > CP THEN
 PP = ((SP - CP)/CP) * 100
 PRINT "PROFIT PERCENTAGE="; PP
 ELSE
 PRINT "NEITHER PROFIT NOR LOSS"
 END IF
 END SUB

Post a Comment

0 Comments