We can solve this problem using the next equations
where
x=5 dollars bills
y= 10 dollars bills
x+y=124 (1)
5x+10y=840 (2)
we need to solve the system equation we clear x of the (1)
x=124-y
we use the value of x and we substitute in (2)
5(124-y)+10y=840
620-5y+10y=840
5y=840-620
5y=220
y=220/5
y=44
then we calculated the value of x
x=124-44=80
Number of 5 dollar bills: 80
Number of 10 dollar bills: 44