I am trying to prove the following result
If $f$ is a continuous function on a closed interval $[a,b]$, then there exists a $c \in (a,b)$ such that,
$$f(c)=\frac{1}{b-a}\int_a^bf(x)\;\mathrm{d}x$$
I have worked out the following proof
Because $f$ is continuous on the interval, it reaches a minimum $m$, and a maximum $M$ so that we have $$\begin{aligned} m&\leq f(x)\leq M \\ m(b-a)\leq & \int_a^bf(x)\;\mathrm{d}x\leq M(b-a) \\ m\leq &\frac{1}{b-a}\int_a^bf(x)\;\mathrm{d}x\leq M\end{aligned}$$ and the IVT guarantees the exxistence of $c$ as above.
How do I prove that $c \neq a\ \& \ c\neq b$?
Thanks for the help !

If $f$ is constant, there is nothing to do.
Otherwise, let $M=\max f$ and $m=\min f$ on $[a,b]$ with $m\neq M.$ Then, $m\le \frac{\int_a^bf(t)dt}{b-a}\le M$ so the Intermediate Value Theorem gives us a $c\in [a,b]$ such that $f(c)=\frac{\int_a^bf(t)dt}{b-a}.$
If $c\in (a,b),$ we are done.
If $c=a$ then $f(a)=\frac{\int_a^bf(t)dt}{b-a}.$ If $f(a)=m,$ then $\int_a^b(f(t)-m)dt=0$ and since $f-m\ge 0$ on $[a,b]$ and continuous there, $f-m=0$ and $f$ is constant. Similarly, if $f(a)=M$ we get $f=M$.
So there are $a<x_0\neq x_1<b$ such that $f(x_0)=m$ and $f(x_1)=M.$ Without loss of generality, $x_0<x_1.$
Then, $m<f(a)<M$ so appying the IVT again, we get a $x_0\le d\le x_1$ such that $f(d)=f(a)$ and the result follows.
An almost identical argument shows that the result also holds if $c=b.$