Track total ages before and after the change.
• Before: 40 people, average 25 → total age = 40 × 25 = 1000.
• After: 35 people, average 26 → total age = 35 × 26 = 910.
• 5 new passengers, average 30 → they add 5 × 30 = 150.
Let x be the average age of the 10 who left. They took away 10x.
1000 − 10x + 150 = 910
1150 − 10x = 910
10x = 240 → x = 24.
Final Answer: 24