Depending on exactly what you want you could use the listings package,
or the algorithms package

\documentclass{article}
\usepackage{listings}%
\usepackage{xcolor}
\lstset{%
backgroundcolor=\color{yellow},%
basicstyle=\small\ttfamily,%
numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt,%
}%
\lstset{emph={%
downto, for%
},emphstyle={\color{red}\bfseries\underbar}%
}%
\begin{document}
\begin{lstlisting}
y = 0
for i = n downto 0
y = a_i + x * y
\end{lstlisting}
\end{document}
The first lstset above sets the options in terms of the background color, the font family and what kind of numbering to use.
Add any keywords you want highlighted in the second lstset, or comment this out if you don't want that. Or add additional lstset if you want different groups of words highlighted differently.
If you need the code to by typeset then you can use the algorithmic package as follows:
\documentclass{article}
\usepackage{algorithmic}
\newcommand{\downto}{\to}% Select what you want to use for this
\renewcommand{\algorithmicdo}{}% Since you don't want the DO at end of FOR
\begin{document}
\begin{algorithmic}[1]% Number every line
\FOR{$i = n \downto 0$}
\STATE $y = a_i + x * y$
\ENDFOR
\end{algorithmic}
\end{document}
If you don't want the end for you can use \renewcommand{\algorithmicendfor}{}