We know 10 take neither French (F) nor Spanish (S).
So F only + S only + both = 40...(i)
(F Only + both) + (S only + both) = 31 + 17...(ii)
(ii) - (i) = 8
So F only + S only + both = 40...(i)
(F Only + both) + (S only + both) = 31 + 17...(ii)
(ii) - (i) = 8