LCM of 45 and 40 is 360. so let the work be of eating 360 chocolates.
A finishes work in 40 days and B in 45 so A eats 9 chocolates per day and B eats 8 chocolates per day.
together they work for 10 days and eat 17 chocolates each day.
total chocolates eaten in 10 days=170.
number of chocolates left=360-170=190
A will eat 190 chocolates in=>`190/9=21.1 days.`