$7.11 in four prices and the Decimal type

There’s an fun and not very difficult programming exercise, presented on Programming Praxis . The problem is easy to describe: “A mathematician purchased four items in a grocery store. He noticed that when he added the prices of the four items, the sum came to $7.11, and when he multiplied the prices of the four items, the product came to $7.11.” Ok, the problem is easy to get on a brute force approach. Just try all the combinations, see their sum and multiplication, and find the one that gets it. Well, easy,… Read More