Please help,

John has some cookies. If he gives each of his friends 5 cookies, there is no remainder. If he gives each of them 3 cookies instead, he will have 36 left. How many cookies does John have?

let the number of cookies be x

let the number of friends by y

x - 5y = 0
x - 3y = 36
subtract them:
-2y = -36
y = 18

x - 5(18) = 0
x = 90

John has 90 cookies.

To solve this problem, let's work through it step by step.

Let's assume that John initially had "x" number of cookies.

According to the problem, if John gives each of his friends 5 cookies, there is no remainder. This means that the number of cookies should be divisible by the number of friends. Let's call the number of friends "f."

So, when John gives each friend 5 cookies, the total number of cookies given away is 5f.

Therefore, we can write the following equation: x - 5f = 0.

Next, the problem states that if John gives each friend 3 cookies instead, he will have 36 cookies left. So, the total number of cookies given away this time is 3f.

We can write the second equation: x - 3f = 36.

We now have a system of equations:
Equation 1: x - 5f = 0
Equation 2: x - 3f = 36

Now, we can solve the system of equations simultaneously. Subtracting Equation 2 from Equation 1, we get:

(x - 5f) - (x - 3f) = 0 - 36
x - 5f - x + 3f = -36
-2f = -36

If we divide both sides of the equation by -2, we get:

f = -36 / -2
f = 18

Now that we know the number of friends (f), we can substitute it into Equation 1 to find x (the initial number of cookies):

x - 5(18) = 0
x - 90 = 0
x = 90

Therefore, John initially had 90 cookies.