A man wishes to sell a puppy for $11. A customer wants to buy it but only has foreign currency. The exchange rate for the foreign currency is 11 round coins = $15, 11 square coins = $16, 11 triangular coins = $17.
How many of each coinage should the customer pay?
If no. of round,square and triangular coins are x,y and z then we have simple equation to solve.
15x+16y+17z=121
We can then make an exhaustive search using a simple C program.
|
Posted by Sandeep
on 2003-11-03 11:31:16 |