Latest Articles

WAP to input Decimal Number and convert it to Binary Number.

Question:
Write a program to input decimal number and convert it to binary number.

Ans:
            INPUT "Enter any number" ; n
            t = 0
            p = 1
            WHILE n < > 0
            r = n MOD 2
            t = t + r * p
            p = p * 10
            n = n \ 2
            WEND
            PRINT "Binary Number = " ; t
            END
















Ans in Image: