Algoritmic return command = 0
You're probably combining the use of algorithmic
and algorithmicx
package. The latter can be used as a full replacement of the former, so you should not load them together (the error is reproduced when they are loaded in sequence \usepackage{algorithmic,algcompatible}
). I would suggest using it in the following way:
\documentclass{article}
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algcompatible}% http://ctan.org/pkg/algorithmicx
% Define keyword and construction of \RETURN
\algnewcommand\algorithmicreturn{\textbf{return}}
\algnewcommand\RETURN{\State \algorithmicreturn}%
\begin{document}
\begin{algorithm}
\caption{My algorithm}\label{alg1}
\begin{algorithmic}[1]
\RETURN{} $C$
\end{algorithmic}
\end{algorithm}
\end{document}
This requires you to define the \RETURN
keyword to function properly. There may be others as well that you need to define to work properly. However, they can be done in the same way.
Based on the code you posted, the following might be a way of defining your algorithm structures:
\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\usepackage{algorithm,algcompatible}% http://ctan.org/pkg/{algorithms,algorithmicx}
\algnewcommand\algorithmicreturn{\textbf{return}}
\algnewcommand\RETURN{\algorithmicreturn}
\algnewcommand\algorithmicprocedure{\textbf{procedure}}
\algnewcommand\PROCEDURE{\item[\algorithmicprocedure]}%
\algnewcommand\algorithmicendprocedure{\textbf{end procedure}}
\algnewcommand\ENDPROCEDURE{\item[\algorithmicendprocedure]}%
\algnewcommand{\algvar}[1]{{\text{\ttfamily\detokenize{#1}}}}
\algnewcommand{\algarg}[1]{{\text{\ttfamily\itshape\detokenize{#1}}}}
\algnewcommand{\algproc}[1]{{\text{\ttfamily\detokenize{#1}}}}
\algnewcommand{\algassign}{\leftarrow}
\begin{document}
\begin{algorithm}% enter the algorithm environment
\caption{procedure DOWNLOAD}% give the algorithm a caption
\label{SaS:DOWNLOAD}
\begin{algorithmic}[1]% enter the algorithmic environment
\raggedright
\PROCEDURE \algvar{user_request}(\algarg{follower_id}, \algarg{friend_id}, \algarg{content_id}, \algarg{home_server}, \algarg{friend_surrogate})
\REQUIRE \algarg{user_id}, \algarg{home_server}
\ENSURE URL of requested content
\STATE $\algvar{content} \algassign \algproc{request_redirect}(\algarg{content_id})$
\IF{$\algvar{content} \neq \algvar{server}$}
\STATE \algproc{schedule_pull}(\algarg{content_id}, \algvar{server})
\ENDIF
\STATE \RETURN{} \algvar{content_host}
\ENDPROCEDURE
\end{algorithmic}
\end{algorithm}
\end{document}
In an attempt to be consistent, define macros that would handle formatting of like items.