Wednesday, February 20, 2019

write a qbasic program to convert binary number to octal equivalent number

write a qbasic program to convert binary number to octal equivalent number

CLS
INPUT "enter binary number"; n#
WHILE n# <> 0
    r = n# MOD 10
    s = s + r * 2 ^ i
    i = i + 1
    n# = n# \ 10
WEND
i = 1
WHILE s <> 0
    r1 = s MOD 8
    d = d + r1 * i
    s = s \ 8
    i = i * 10
WEND
PRINT "Octal equivalent number="; d
END

No comments:

Post a Comment