Final answer:
David has 2 guests.
Step-by-step explanation:
To solve this problem, we can use algebra. Let's call the number of guests David has 'x'. We know that David cuts 5 apples into slices and gives 8 slices to each guest. So, the total number of apple slices is 5*8 = 40. We also know that he has 2 apples left over, which means he had 10 slices of apples left. Since each guest received 8 slices, we can set up the equation 8x = 10. Solving for 'x', we find that x = 1.25. However, we can't have a fraction of a guest, so we round up to the nearest whole number, which is 2.
Therefore, David has 2 guests.