Answer
Please see below.
Work Step by Step
We want to prove the statement by contradiction.
Suppose that neither $f(x)>0$ for all $x$ in $[a,b]$ nor $f(x)<0$ for all $x$ in $[a,b]$. So there must exist some $y,z$ in $[a,b]$ such that $f(y)>0$ and $f(z)<0$.
Since $f(x)$ is continuous on the closed interval $[a,b]$ and $f(y) >0, \, f(z)<0$, $y,z \in [a,b]$, there must exist some $c$ in $[a,b]$ such that $f(c)=0$ according to the Intermediate Value Theorem, which contradicts the hypothesis in the statement.
Thus, we must have the fact that either $f(x)>0$ for all $x$ in $[a,b]$ or $f(x)<0$ for all $x$ in $[a,b]$.