QBasic Programming

Calculate total saving of a man if he earns Rs. 10,000 per month and spends 20% on food, 15% on children’s education, 10% on entertainment and 20% on rent

REM CALCULATE TOTAL SAVINGS OF A MAN
CLS
LET S = 10000
F = 20 / 100 * S
C = 15 / 100 * S
E = 10 / 100 * S
R = 20 / 100 * S
T = S – (F + C + E + R)
PRINT “ TOTAL SAVING =”; T
END
USING SUB PROCEDURE
DECLARE SUB SAVING ( S)
COMMON SHARED F, C, E, R
CLS
F = 20 / 100 * S
C = 15 / 100 * S
E = 10 / 100 * S
R = 20 / 100 * S
CALL SAVING(S)
END
SUB SAVING(10000 )
T = S – (F + C + E + R)
PRINT “ TOTAL SAVING =”; T
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION SAVING ( S)
COMMON SHARED F, C, E, R
CLS
LET S = 10000
F = 20 / 100 * S : C = 15 / 100 * S
E = 10 / 100 * S
R = 20 / 100 * S
PRINT SAVING(S)
END
FUNCTION SAVING( S)
T = S – (F + C + E + R)
SAVING = T
 END FUNCTION

Ask quantity of pen, copy and pencil and their rate and find out the total amount (Prev Lesson)
(Next Lesson) Input sales amount and rate of commission then calculate commission and return nt sales. [ns=sa-c)
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!