If you want to go the contradiction route, here's one. Assume there is some $c\in (a, b)$ s.t. $f(c) \neq 0$. Just for simplicity's sake, say $f(c)\gt 0$.
By definition of continuity, there is some $\epsilon >0$ such that for any $x \in (c-\epsilon, c+\epsilon)$, we have $f(x) > 0$. Let $g$ be a function which is $0$ outside that interval, and positive within the interval. Then
is strictly positive. Thus we have a contradiction. (The case $f(c)< 0$ is completely analogous, only the integral is strictly negative. Still, we have a contradiction.)
An example of a $g$ with the properties we want (just to convince you that it exists) is the funtion which is equal to $0$ outside the interval $(c-\epsilon, c+\epsilon)$, and within the interval is equal to $\epsilon^2 - (x-c)^2$