Is it possible to find such a $f$? I search a continuous function $f : [0,+\infty[ \to \mathbb{R}$ such as : $\lim \limits_{x\to +\infty} \frac{1}{x} \int \limits_{0}^{x} f(t)\mathrm{d}t=\pm \infty$ and ($\lim \limits_{x\to +\infty}f(x)=l\in \mathbb{R}$ or $f$ does not have limits).
First I know that it doesn't work with monotone functions. Then I start to try with $x\mapsto cos(x)^2$ but it didn't work.
Thanks in advance !
 A: If  $l$ exists, then for any positive r, choose positive y, where $y<x$ implies $abs(l-f(x))<r$.The integral of f from y to x, for x>y, lies between $(x-y)(l-r)$ and $(x-y)(l+r)$. The integral of f from o to y does not depend on any x that's greater than y. Add them, divide by x, and let x go to infinity. As r can be arbitrarily small, the limit is $l$, not plus or minus infinity.
A: Let us look at the two cases: 


*

*Let us prove there is no continuous function $f : [0,+\infty[ \to \mathbb{R}$ such as : $\lim \limits_{x\to +\infty} \frac{1}{x} 
\int \limits_{0}^{x} f(t)\mathrm{d}t=\pm \infty$ and $\lim \limits_{x\to +\infty}f(x)=l\in \mathbb{R}$ 


If $f : [0,+\infty[ \to \mathbb{R}$ is a continuous function and $\lim \limits_{x\to +\infty}f(x)=l\in \mathbb{R}$, it is easy to prove that $f$ is bounded. So there are $M$ such that, for all $x\in [0,+\infty[\,$, $\vert f(x) \vert \leq M$. So, for all $x\in [0,+\infty[\,$,
$$\left\vert\frac{1}{x} 
\int \limits_{0}^{x} f(t)\mathrm{d}t\right \vert\leq \frac{1}{x} 
\int \limits_{0}^{x} \vert f(t) \vert \mathrm{d}t \leq M$$
So we can NOT have $\lim \limits_{x\to +\infty} \frac{1}{x} 
\int \limits_{0}^{x} f(t)\mathrm{d}t=\pm \infty$.


*On the other hand, it is rather easy to present examples of continuous functions $f : [0,+\infty[ \to \mathbb{R}$ such as : $\lim \limits_{x\to +\infty} \frac{1}{x} 
\int \limits_{0}^{x} f(t)\mathrm{d}t=\pm \infty$ and $f$ does not have limits.


Example 1: Define $f(x)=x(1+\sin(x))$
Example 2: [from David C. Ullrich comment] Define $f(x)=x\cos^2(x)$ 
