QBASIC PROGRAM TO CONVERT OCTAL NUMBER INTO DECIMAL EQUIVALENT

QBASIC PROGRAM TO CONVERT OCTAL NUMBER INTO DECIMAL EQUIVALENT



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

USING SUB


DECLARE SUB OCTD(N$)
 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 SUB

Post a Comment

0 Comments