Hello all!
Today, my professor gave us a puzzle to solve using programming, but it has stumped me.
Here is the problem:
Anyone know a C program to write that will search through all possible solutions? It can ONLY have while loops and if/else statements.
Help is very much appreciated!
/>
Today, my professor gave us a puzzle to solve using programming, but it has stumped me.
Here is the problem:
Quote
You're given a hundred dollars and told to spend it all purchasing exactly a hundred animals at the pet store. Dogs cost $15. Cats cost a buck, and mice are 25 cents each.
The only other criterion is that you have to purchase at least one of each animal.
How many of each animal do you have to purchase to equal a hundred animals purchased at exactly a hundred dollars?
The only other criterion is that you have to purchase at least one of each animal.
How many of each animal do you have to purchase to equal a hundred animals purchased at exactly a hundred dollars?
Anyone know a C program to write that will search through all possible solutions? It can ONLY have while loops and if/else statements.
Help is very much appreciated!
