Let
x ------> number of friends of his agree that each one will give him a $5 donation
y -----> the number of friends who must pay him $0.25 for each correct answer
so
to win headphones-------> $350
we have that
x=3y -------> equation A
5x+0.25y=350 -------> equation B
substitute equation A in equation B
5(3y)+0.25y=350
solve for y
15y+o.25y=350
15.25y=350
y=22.95
therefore
the answer is 23 friends who must pay him $0.25 for each correct answer