Rodrick had a certain number of sweets. If he gives 3 sweets to each of his friends, he will have 7 sweets left. If he gives 5 sweets to each of his friends, he will need 9 more sweets. How many friends does he have?

Let's call the number of sweets Rodrick has "x" and the number of friends he has "f".

From the first sentence, we know that:

x - 3f = 7

From the second sentence, we know that:

x - 5f = -9

Now we can solve for f by using either of these equations.

Let's use the first one:

x - 3f = 7

x = 3f + 7

Now we can substitute this expression for x in the second equation:

3f + 7 - 5f = -9

-2f = -16

f = 8

So Rodrick has 8 friends.

To check, we can substitute this value of f into one of the original equations:

x - 3f = 7

x - 3(8) = 7

x - 24 = 7

x = 31

So Rodrick has 31 sweets.

Now we can check the other equation as well:

x - 5f = -9

31 - 5(8) = -9

31 - 40 = -9

-9 = -9

Both equations check out, so we can be confident in our answer of 8 friends.

Let's represent the number of sweets Rodrick initially had as "S" and the number of friends he has as "F".

According to the first condition, if he gives 3 sweets to each of his friends, he will have 7 sweets left. This can be expressed with the equation: S - 3F = 7.

According to the second condition, if he gives 5 sweets to each of his friends, he will need 9 more sweets. This can be expressed with the equation: S - 5F = -9.

Now, we can solve these equations using a method called substitution to find the values of S and F.

From the first equation, we can express S in terms of F as: S = 3F + 7.

Substituting this value of S in the second equation, we get: (3F + 7) - 5F = -9.

Simplifying the equation, we have: -2F + 7 = -9.

Subtracting 7 from both sides, we get: -2F = -16.

Dividing both sides by -2, we get: F = 8.

So, Rodrick has 8 friends.