Computer Science, asked by thapapritisha04, 10 days ago

WAP that asks any binary number and calculate its decimal equivalent using QBASIC

Answers

Answered by atrs7391
3

CLS

INPUT "Input binary: "; BINARY$

FOR I = LEN(BINARY$) TO 1 STEP -1

B$ = MID$(BINARY$, I, 1)

NUMBER = NUMBER + VAL(B$) * 2 ^ P

P = P + 1

NEXT I

PRINT "Number: "; NUMBER

END

Similar questions