Consider the signal $ x(t)=cos(5t) $.
Energy
First we find the energy for one complete cycle $ E=\int_0^{2\pi}{|cos(5t)|^2dt} $
$ =\frac{1}{2}\int_0^{2\pi}(1+cos(10t))dt $
$ =\frac{1}{2}(t+\frac{1}{10}sin(10t))|_{t=0}^{t=2\pi} $
$ =\frac{1}{2}(2\pi+0-0-0) $
$ =\pi $
Energy
We will find the average power in one cycle of the cosine waveform.
$ E=\frac{1}{2\pi-0}\int_0^{2\pi}{|cos(5t)|^2dt} $
$ =\frac{1}{2\pi-0}\frac{1}{2}\int_0^{2\pi}(1+cos(10t))dt $
$ =\frac{1}{4\pi}(t+\frac{1}{10}sin(10t))|_{t=0}^{t=2\pi} $
$ =\frac{1}{4\pi}(2\pi+0-0-0) $
$ =\frac{1}{2} $