"""
Iterative approach
"""

# Prompt the user to input a decimal number as an integer.
decimal = int(input("Please enter the decimal representation of a number: "))

# Initialize an empty string to store the binary result.
result = ""

# Loop until the decimal number is reduced to 0.
while decimal != 0:
    # Get the remainder when dividing by 2 (current binary digit) and prepend it to the result.
    result = str(decimal % 2) + result
    # Update the decimal number by performing integer division by 2.
    decimal = decimal // 2

# Print the final binary representation of the input number.
print(f"The binary representation of your number is {result}")
