We'll call the respective mileages x and y, in miles per gallon, mpg.
So 15 gallons in car 1 gets us a distance of 15x.
25 gallons in car 2 gets us a distance of 25y.
The combined distance is 950 miles:
15x + 25y = 950
The sum of the mileages (whoever cares about that?) is 50 mpg.
x + y = 50
Solving,
y = 50 - x
15x + 25(50 - x) = 950
-10 x = 950 - 1250 = -300
x = 30
y = 20
Check: 15(30)+25(20)=450+500=950 good
Answer: Car 1: 30 mpg; Car 2: 20 mpg