Let the number of marbles Kumar had be x.
Then the number of marbles Kavya had = 45–x
The number of marbles left with Kumar, when he lost 5 marbles = x–5
The number of marbles left with Kavya, when she lost 5 marbles = 45–x–5
= 40–x
∴ their product = (x−5)×(40−x)
= 40x – x2−200+5x
= −x2 + 45x–200
So, −x2 + 45x–200=124 (Given that product = 124)
⇒ −x2 + 45x–324=0
⇒ x2 – 45x+324=0