I want to type an algorithm in ieee format. I have used algorithmic package. But using that package, I couldn't type a caption to the algorithm and "Algorithm " above the written algorithm. What should I do to get those things written in my algorithm ? I need the algorithm as in the given figure.
The structure I have used is given below
\documentclass{IEEEtran}
\usepackage{algorithmic}
\begin{document}
%\begin{algorithm}
%\caption{Algorithm for ...}
\begin{algorithmic}[1]
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\REQUIRE in
\ENSURE out
\\ \textit{Initialisation} :
\STATE first statement
\\ \textit{LOOP Process}
\FOR {$i = l-2$ to $0$}
\STATE statements..
\IF {($i \ne 0$)}
\STATE statement..
\ENDIF
\ENDFOR
\RETURN $P$
\end{algorithmic}
%\end{algorithm}
\end{document}


\captiondoes not work outside of a floating environment ...algoritmicseems to be is a non-floating environment, but perhaps, there are package options to 'cure' this