mardi 24 août 2021

How would I figure out how many bills it takes to reach a certain listed monetary value

In Java:

Figure out how many bills it takes to reach certain monetary value:

Example:

bill1 = 100

bill2 = 50

bill3 = 20

bill4 = 10

bill5 = 5

bill6 = 1

Total value: 374

the result returned should be:

Bill1: 3

Bill2: 1

Bill3: 1

Bill4: 0

Bill5: 0

Bill6: 4

It should work for whatever number I have for bills as well as whatever value I choose.

Aucun commentaire:

Enregistrer un commentaire