PYHTON PROGRAM
def Decimal(n):
d=0
base=1
num=n
while(n>0):
rem=n %10
d=d+ rem * base
n=n//10
base=base * 2
print ("Decimal number of",num,"is:\n",d)
Decimal(1111)
Decimal(1000)
Decimal(10001100)
Decimal(100)
Decimal(111)
Decimal(1011)
Decimal(10)
Decimal(1001)
No comments:
Post a Comment
let me know which type examples you want to comment me.