1.

Write a program to convert decimal number to binary.

Answer»

i=1

s=0

dec = int ( raw_input(“Enter the decimal to be converted:”))

while dec>0:

rem=dec%2

s=s + (i*rem)

dec=dec/2

i=i*10

print “The binary of the given number is:”,s raw_input()



Discussion

No Comment Found