Gerald had a number of magazines and storybooks for sale. 40% of them were magazines and the rest were storybooks, When some magazines were sold, 15% of the total number of magazines and storybooks left were magazines. A total of 360 magazines and storybooks were left. How many magazines were sold?

total number of items for sale ---- 10x

number of mags = 4x
number of books = 6x

number of mags sold --- y
number of mags left = 4x - y
total left = 4x-y + 6x = 10x - y = 360
.15(10x - y) = 4x-y

solving this I got x = 51 and y = 150

put it all together.

Let x be the total number of magazines and storybooks that Gerald had.

Let y be the number of magazines that Gerald had.
Let z be the number of magazines that were sold.

From the problem statement, we know that 40% of the total number of magazines and storybooks were magazines. This means that:

y = 0.4x

We also know that after some magazines were sold, 15% of the total number of magazines and storybooks left were magazines. This means that:

(y - z) = 0.15(x - z)

Finally, we know that there were a total of 360 magazines and storybooks left. This means that:

x - z = 360

Now we have three equations with three unknowns. We can solve for them using substitution or elimination.

Substituting y = 0.4x into the second equation, we get:

(0.4x - z) = 0.15(x - z)

0.25x = 0.85z

z = (0.25/0.85)x

Substituting z = (0.25/0.85)x into the third equation, we get:

x - (0.25/0.85)x = 360

(0.6/0.85)x = 360

x = (360*0.85)/0.6

x = 510

Therefore, Gerald had a total of 510 magazines and storybooks.

To find out how many magazines were sold, we can substitute x and z into one of the previous equations:

(y - z) = 0.15(x - z)

(0.4*510 - z) = 0.15(510 - z)

204 - z = 76.5 - 0.15z

0.85z = 127.5

z = 150

Therefore, Gerald sold 150 magazines.