Lesson Archives

  1. 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 […]
  2. 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" […]
  3. 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 […]
  4. 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 […]
  5. 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 […]
  6. 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) […]
  7. 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 […]
  8. 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 !!