β λμ κ΅ν νλ‘κ·Έλ¨
κ΅νν λμ λ°μ money λ³μλ₯Ό μ μΈν΄μ£Όκ³
κ°κ° κ΅νλ λμ μ λ΄μ λ³μλ€λ μ μΈν΄μ€λ€.
// μ°μ°μλ₯Ό ν΅ν΄μ
μ°¨λ‘λλ‘
moneyλ₯Ό 500μΌλ‘ λλ λͺ«λ§ C500μ μ μ₯νκ³
λλ¨Έμ§ κ°μ λ€μ money μ μ μ₯νλ€
κ·Έ λ€μμ 100μ 50μ λ°λ³΅ ν
μΆλ ₯ν΄μ£Όλ©΄ λλ€.
## λ³μ μ μΈ ##
money, c500, c100, c50, c10 = 0,0,0,0,0
## λ©μΈ μ½λ ##
money = int(input("κ΅νν λμ μΌλ§μ
λκΉ?"))
c500 = money // 500
money %= 500
c100 = money // 100
money %= 100
c50 = money // 50
money %= 50
c10 = money // 10
money %= 10
print("\n 500μ μ§λ¦¬ λμ => %dκ°" % c500)
print("\n 100μ μ§λ¦¬ λμ => %dκ°" % c100)
print("\n 50μ μ§λ¦¬ λμ => %dκ°" % c50)
print("\n 10μ μ§λ¦¬ λμ => %dκ°" % c10)
print("\n μλ => %dκ°" % money)
β λμ κ΅ν νλ‘κ·Έλ¨ (μμ©)
## λ³μ μ μΈ ##
money, c50000, c10000, c5000, c1000 = 0,0,0,0,0
## λ©μΈ μ½λ ##
money = int(input("κ΅νν λμ μΌλ§μ
λκΉ?"))
c50000 = money // 50000
money %= 50000
c10000 = money // 10000
money %= 10000
c5000 = money // 5000
money %= 5000
c1000 = money // 1000
money %= 1000
print("\n 50000μ μ§λ¦¬ => %dμ₯" % c50000)
print("\n 10000μ μ§λ¦¬ => %dμ₯" % c10000)
print("\n 5000μ μ§λ¦¬ => %dμ₯" % c5000)
print("\n 1000μ μ§λ¦¬ => %dμ₯" % c1000)
print("\n μλ => %dμ" % money)