CPhill while reading your answer i just figured out another method which could give the same right answer !
check this out :
let 7 and 8 be 7x and 8x.
ATQ ; 7x +8x = 45
=15x =45
x= 45/15
x=3
therefore ,
7x = 7*3 = 21
8x=8*3=24
isnt that correct
by the way thanks for another formula but dont mind i find this one a lil hard