Artificial intelligent assistant

Show that if $f$ is continuous on $[0, \infty)$ and $\lim_{x \to \infty} f(x) = a$ that $\lim_{x \to \infty} 1/x \int_0^x f(t)dt = a$. Intuitively, I see this statement as saying that if a continuous function has a finite limit as x tends to infinity, the average value of the function is that same limit (which makes sense, since there are "infinitely many" contributions of that value to the average, very roughly speaking). I'm having trouble proving it with any rigour though. It looks like the fundamental theorem of calculus could be applied at first glance, but there really doesn't seem to be any use for it.

Suppose that $f(x) \to 0$. Then for any $\varepsilon>0$ there exists $A>0$ fixed such that $|f(x)|<\varepsilon$ for all $x>A$.

Therefore $\frac{1}{x}|\int_0^xf(t)dt| \le \frac{1}{x}\int_0^A|f(t)|dt + \frac{1}{x}\int_A^x|f(t)|dt \le \frac{A}{x}\sup_{t \in [0,A]}|f(t)|+\varepsilon\frac{x-A}{x}$ The first term can be made $<\varepsilon$ the second too.

If the limit is not zero you can write $\frac{1}{x}\int_0^x(f(t)-a)dt+\frac{1}{x}\int_0^x a dt$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 342e9adc667893dff07747c24a028cde