➽ Program:-
number
= int(input("Enter a Decimal Number: "))
binary_value
= 0
base
= 1
decimal_value
= number
while(number
> 0):
rem = number % 2
binary_value += rem * base
number = int(number / 2)
base = base * 10
print("Binary
Equivalent of",decimal_value,"is",binary_value)
➽ Output:-
Enter a Decimal Number: 185
Binary equivalent of 185 is 10111001
0 Comments
Please do not enter any spam link in the comment section.