John has some sweets to give to his friends. If he gives 4 sweets to his friends, he will need 2 more sweets. If he gives 7 sweets to each friend, he will need 17 sweets. How many friends does John have? How many sweets does John have?

7-4=3 (difference of 3 sweets given)

For a difference of 3 sweets, total sweets needed:
17-2=15
15 sweets need for each friend having 3 more sweet, hence the number of John friend:
15/3=5

If John give each friends 4 sweets:
5x4=20
However John is short of 2 sweets (needs 2)
20-2=18
Therefore, John has 18 sweets

To solve this problem, let's assign variables to the unknowns:

Let's say John has 'x' number of friends.
Let's say John has 'y' number of sweets.

According to the first condition, if John gives 4 sweets to his friends, he will need 2 more sweets. This can be expressed as:

y - 4 = 2

Simplifying this equation, we find that:

y = 6

According to the second condition, if John gives 7 sweets to each friend, he will need 17 sweets. This can be expressed as:

7x = 17

Simplifying this equation, we find that:

x = 17/7

Now, let's calculate the values of 'x' and 'y':

Using the first equation, we found that y = 6. So, John has 6 sweets.
Using the second equation, we found that x ≈ 2.43. Since we can't have fractional friends, we can conclude that John has 2 friends.

Therefore, John has 2 friends, and he has 6 sweets.