The "division algorithm" states that:
Dividend = Divisor × Quotient + Remainder, where R<D
for example:
115 = 7*16+3, tells us that we can fit 7 into 115 at most 16 times,
Back to our problem, the Dividend is a 3 digit number, say abc, the divisor is 40 and the remainder is 4, so we have:
Dividend = Divisor × Quotient + Remainder
abc = 40 × Quotient + 4
we can try some values for the Quotient, but it almost immediately clear that the smallest Quotient that will produce the smallest dividend is 3:
40*2+4=80+4=84 (not 3 digit)
40 * 3 + 4=120+4=124 (the smallest 3 digit dividend)
Answer: 124