Cost price of 100 articles =
He sold 20 of them at a gain of 5%. So the selling price = 40x105/100 = $ 42 per article
Selling price of 20 article =
For 20 % gain on whole the total selling price =
Total Selling price of remianing 80 articles =
Selling price of ramaining articles =
Gain % = (49.5-40)x100/40 = 23.75 %