To convert binary number into its equivalent decimal number (Qbasic Code)
- CLS
INPUT "Enter binary number"; b$
FOR i = LEN(b$) TO 1 STEP -1
d$ = MID$(b$, i, 1)
d = VAL(d$) * 2 ^ a
dec = dec + d
a = a + 1
NEXT i
PRINT "The equivalent decimal number is "; dec
END
- CLS
INPUT "Enter binary number"; a
WHILE a <> 0
r = a MOD 10
s = s + r * 2 ^ p
p = p + 1
a = a \ 10
WEND
PRINT "The equivalent decimal is "; s
END