Andrew has 180 red pens and blue pens at first. He gave away 40% of the red pens and 10% of the blue pens. In the end, he was left with 48 more red pens than blue pens. How many red pens did he have at first?

Let, he had red pens at first = x

Hence, blue pens at first = 180 - x
After, gave away,
red pens = x - x * 40/100 = 6x/10
blue pens = (180 - x) - (180 - x) * 10/100
Now, 6x/10 = 162 - 9x/10 + 48
6x/10 = 162 - 9x/10 = 210
x = (210 * 10)/15 = 140
Hence, at first he had red pens = 140