QBasic Programming

WAP to input total number of words and compute telegram charges which are as follows

For the first 20 words    :           Rs 15
For the next 20 words : Rs 10
Above that for each word:         Re 1


CLS
INPUT "ENTER HOW MANY WORDS"; W
IF W <= 20 THEN
C = 15
ELSEIF W > 20 AND W <= 40 THEN
C = 15 + 10
ELSEIF W > 40 THEN
C = 15 + 10 + (W - 40)
END IF
PRINT "NUMBER OF WORDS="; W
PRINT "TOTAL CHARGE="; C

END

USING SUB PROCEDURE

DECLARE SUB TOTAL(W)
CLS
INPUT "ENTER HOW MANY WORDS"; W
CALL TOTAL(W)
END
SUB TOTAL(W)
IF W <= 20 THEN
C = 15
ELSEIF W > 20 AND W <= 40 THEN
C = 15 + 10
ELSEIF W > 40 THEN
C = 15 + 10 + (W - 40)
END IF
PRINT "NUMBER OF WORDS="; W
PRNT "TOTAL CHARGE="; C
END SUB

WAP to input number of passengers and their destination (Prev Lesson)
(Next Lesson) In order to discourage heavy consumption of electricity, the electricity board charges the following rates
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!