Answer: He bought 4 pastries.
Step-by-step explanation:
Let x = Number of cups of coffee
y= Number of pastries.
As per given,
x+y=9 ....(i)
2.5x+4y=28.50 ...(ii)
Multiply 4 to (i), we get
4x+4y=36 ...(iii)
Eliminate (ii) from (iii), we get
[tex]1.5x=7.5\\\\\Rightarrow\ x=5[/tex]
Put x=5 in (i) , we get
5+y=9
y= 4
Hence, He bought 4 pastries.