LaTex-Algorithm-and-Pseudocode

Beautiful Algorithm-and-Pseudocode Style.

References:

Code

\documentclass{article}
\usepackage{algorithm}
\usepackage{algorithmic}
\begin{document}
\begin{algorithm}
    \caption{Calculate $y = x^n$}
    \label{alg1}
    \begin{algorithmic}
    \REQUIRE $n \geq 0 \vee x \neq 0$
    \ENSURE $y = x^n$
    \STATE $y \gets 1$
    \IF{$n < 0$}
    \STATE $X \gets 1 / x$
    \STATE $N \gets -n$
    \ELSE
    \STATE $X \gets x$
    \STATE $N \gets n$
    \ENDIF
    \WHILE{$N \neq 0$}
    \IF{$N$ is even}
    \STATE $X \gets X \times X$
    \STATE $N \gets N / 2$
    \ELSE[$N$ is odd]
    \STATE $y \gets y \times X$
    \STATE $N \gets N - 1$
    \ENDIF
    \ENDWHILE
    \end{algorithmic}
  \end{algorithm}
\end{document}

Style

It looks like: