货币面额

时间:2009-03-27 11:05:46

标签: vb.net

我有工资单数据库,在我的工资单工资单上我想为每个雇员的工资赚钱,即如果一个雇员有759美元然后出纳员将退出7一百,1五十Dolar,9十美元从一个班克  请在vb.net中给我一个代码

薪水百五十十

759 7 1 9

请帮我解决很多问题

1 个答案:

答案 0 :(得分:0)

这是python中的答案:

# Target amount
amount = 759

# The denominations to be used, sorted
denoms = [100, 50, 20, 10, 5, 1]

# Take as many of each denomination as possible
for d in denoms:
  count = amount // d
  amount -= count * d
  print "%ix%i" % (count, d)

示例输出:

7x100
1x50
0x20
0x10
1x5
4x1