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.

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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top