# I cant find why im getting two values

``````# getting the input from the user
n = int(input('Enter the amount: '))

# converting the cents into dollars and cents
dollars = n // 100
cent = n % 100

# printing the dollars and cents
print('The Change for %d dollars and %d cent' % (dollars, cent))

# variables to store the number of various denomiations of money
hundred_dollars = 0
twenty_dollars = 0
ten_dollars = 0
five_dollars = 0
one_dollars = 0
quarters = 0
dime = 0
nickel = 0
pennies = 0
# converting the cents into hundred dollar
hundred_dollars, dollars = divmod(n, 10000)

# converting the cents into twenty dollar
twenty_dollars, cents = divmod(n, 2000)

# converting the cents into ten dollar
ten_dollars, cents = divmod(cents, 1000)

# converting the cents into five dollar
five_dollars, cents = divmod(cents, 500)

# converting the cents into one dollar
one_dollars, cents = divmod(cents, 100)

# converting the cents into quarters
quarters, cents = divmod(cents, 25)

# converting the cents into dime
dime, cents = divmod(cents, 10)

# converting the cents into pennies and nickel
nickel, pennies = divmod(cents, 5)

# displaying the various denominations

print('%dx Hundred Dollars bills' % hundred_dollars)
print('%dx Twenty Dollars bills' % twenty_dollars)
print('%dx Ten Dollars bills' % ten_dollars)
print('%dx Five Dollars bills' % five_dollars)
print('%dx one Dollars bills' % one_dollars)
print('%dx Quarters' % quarters)
print('%dx Dime' % dime)
print('%dx Nickel' % nickel)
print('%dx Pennies' % pennies)
``````

i have this code written but when i run it it gives me 1x hundred and 5x twenty when it should only say 1x hundred

Youâ€™re determinng the number of items in each denomination, but not subtracting their values as you do so. Youâ€™re always working from the original amount.

Each time, `divmod` is giving you the number of each denomination and the remaining amount.

Also, when posting code, enclose it in backticks to preserve the formatting:

`````````
# A comment
print('Some text')
```
``````
2 Likes

It might be clearer if you renamed `n` to, say, `amount`:

``````amount = int(input('Enter the amount in cents: '))
``````

How many hundred-dollar bills?

``````hundred_dollars, amount = divmod(amount, 10000)
``````

`amount` is now whatâ€™s left after youâ€™ve taken as many hundred-dollar bills as possible.

How many twenty-dollar bills?

``````twenty_dollars, amount = divmod(amount, 2000)
``````

And so on.

THANK YOU i fixed the code and it is now working