Having trouble where to go next on this program:

1. If n is even, then you may give back exactly n/2 bears.

2. If n is divisible by 3 or 4, then you may multiply the last two digits of n and give back this many bears. By the way, the last digit of n is n%10, and the next-to-last digit is ((n%100)/10. Keep in mind that the result of these operations may be 0, in which case, you don't want to use this option.

3. If n is divisible by 5, then you may give back exactly 42 bears.

Here is what I have so far:

```
bool count(int x)
{
if(x==42){
return true;
}else if (x<42){
return false;
}else{
if(x%5==0){
return count(x-42);
}else if(x%2==0){
return count(x/2);
}else if(x%3==0 || x%4==0){
return count(x - ((x%10) * ((x%100)/10))));
}
}
int main()
{
count(250);
return 0;
}
```

<< moderator edit: added code tags: `[co[u][/u]de][/co[u][/u]de]`

>>

Here is how a sample should look like:

bears.

The goal of the game is to end up with EXACTLY 42 bears.

For example, suppose that you start with 250 bears. Then you could make these moves:

• --Start with 250 bears.

• --Since 250 is divisible by 5, you may return 42 of the bears, leaving you with 208 bears.

• --Since 208 is even, you may return half of the bears, leaving you with 104 bears.

• --Since 104 is even, you may return half of the bears, leaving you with 52 bears.

• --Since 52 is divisible by 4, you may multiply the last two digits (resulting in 10) and return these 10 bears. This leaves you with 42 bears.

• --You have reached the goal!

I am having trouble trying to backtrack when n becomes less than 42 in the if statements. ANy help would be much appreciated.