# Lesson Archives

1. ## In order to discourage heavy consumption of electricity, the electricity board charges the following rates

First 80 units:   Rs 4 per unit Next 60 units: Rs 6 per unit Above that :     Rs 7 per unit Every user has to pay a minimum charge of Rs. 100 irrespective of the total amount of electricity consumed. In case total consumption is more than 300 units an additional charge of 10% is […]
2. ## 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 > […]
3. ## WAP to input number of passengers and their destination

The program should calculate the total bus fare and the discount amount according to the following conditions. Rates for the different destinations: Destinations                             Rate Pokhara                                    450 per person Butwal                                     500 per person Chitwan                                   300 per person Discount Rate If the number of passenger is 5 or above then discount=5% in the total amount. Solution: CLS […]
4. ## WAP to convert hexadecimal number to decimal number

CLS INPUT "ENTER HEXADECIMAL NUMBER"; N\$ FOR I = LEN(N\$) TO 1 STEP -1 B\$ = MID\$(N\$, I, 1) IF B\$ = "A" THEN B\$ = "10" IF B\$ = "B" THEN B\$ = "11" IF B\$ = "C" THEN B\$ = "12" IF B\$ = "D" THEN B\$ = "13" IF B\$ = "E" […]
5. ## WAP to convert decimal number to hexadecimal number

CLS INPUT "ENTER DECIMAL NUMBER"; D WHILE D <> 0 R = D MOD 16 IF R < 10 THEN S\$ = STR\$(R) + S\$ ELSE S\$ = CHR\$(R + 55) + S\$ END IF D = D \ 16 WEND PRINT "HEXADECIMAL EQUIVALENT VALUE="; S\$ END USING SUB PROCEDURE DECLARE SUB CONV(D) CLS INPUT […]
6. ## WAP to convert octal number to decimal number

CLS INPUT "ENTER OCTAL NUMBER"; N\$ FOR I = LEN(N\$) TO 1 STEP -1 B\$ = MID\$(N\$, I, 1) S = S + VAL(B\$) * 8 ^ P P = P + 1 NEXT I PRINT "DECIMAL EQUIVALENT VALUE="; S END OR USING SUB PROCEDURE DECLARE SUB CONV(N) CLS INPUT "ENTER OCTAL NUMBER"; N CALL […]
7. ## WAP to convert decimal number to octal number

CLS INPUT "ENTER DECIMAL NUMBER"; D WHILE D  < > 0 R = D MOD 8 S\$ = STR\$(R) + S\$ D = D \ 8 WEND PRINT "OCTAL EQUIVALENT VALUE="; S\$ END USING SUB PROCEDURE DECLARE SUB CONV(D) CLS INPUT "ENTER DECIMAL NUMBER"; D CALL CONV(D) END SUB CONV(D) WHILE D  < > 0 […]
8. ## WAP to convert binary number to decimal number

CLS INPUT "ENTER BINARY NUMBER"; N\$ FOR I = LEN(N\$) TO 1 STEP -1 B\$ = MID\$(N\$, I, 1) S = S + VAL(B\$) * 2 ^ P P = P + 1 NEXT I PRINT "DECIMAL EQUIVALENT VALUE="; S END USING SUB PROCEDURE DECLARE SUB CONV(N) CLS INPUT "ENTER BINARY NUMBER"; N CALL CONV(N) […]
9. ## WAP to convert decimal number to binary number

CLS INPUT "ENTER DECIMAL NUMBER"; D WHILE D < > 0 R = D MOD 2 S\$ = STR\$(R) + S\$ D = D \ 2 WEND PRINT "BINARY EQUIVALENT VALUE="; S\$ END USING SUB PROCEDURE DECLARE SUB CONV(D) CLS INPUT "ENTER DECIMAL NUMBER"; D CALL CONV(D) END SUB CONV(D) WHILE D  < > 0 […]
10. ## WAP to enter any three strings and print the longest one

CLS INPUT "ENTER FIRST STRING"; A\$ INPUT "ENTER SECOND STRING"; B\$ INPUT "ENTER THIRD STRING"; C\$ IF LEN(A\$) > LEN(B\$) AND LEN(A\$) > LEN(C\$) THEN G\$ = A\$ IF LEN(B\$) > LEN(A\$) AND LEN(B\$) > LEN(C\$) THEN G\$ = B\$ ELSE G\$ = C\$ END IF PRINT "LONGEST STRING="; G\$ END USING SUB PROCEDURE DECLARE […]
error: Content is protected !!