An old puzzle: a rooster costs 5 coins, a hen 3 coins, and 3 chicks cost 1 coin. With exactly 100 coins you buy exactly 100 birds. How many roosters x, hens y and chicks z? Show each answer as a line x y z, like 4 18 78. The starter tries every x and y, with chicks z = 100 - x - y, so there are always 100 birds.
0 25 75 4 18 78 8 11 81 12 4 84
#include <stdio.h>
int main(void) {
for (int x = 0; x <= 20; x++) {
for (int y = 0; y <= 33; y++) {
int z = 100 - x - y;
// your code here: if the cost is exactly 100, show this answer
}
}
return 0;
}
Run tries the examples. When they look right, Submit.