# ! LaTeX Error: Something's wrong--perhaps a missing \item

I am using TEXMAKER. Here is a code segment.

\usepackage{algorithmic}
begin{algorithmic}
\FOR {$i\gets0$ to $n$} \do
\FOR {$j \gets$0 \TO $min(i,k)$} \do
\IF {$j=0$ \OR $j=i$}
\STATE $C[i,j] \gets 1$
\ELSE
\STATE $C[i,j] \gets C[i-1,j-1]+C[i-1,j]$
\ENDIF
\ENDFOR
\ENDFOR
\RETURN C[n,k]

\end{algorithmic}

• Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – jub0bs Mar 28 '14 at 13:06

Remove the \dos, and this works fine. As a side note, use $\min(i,k)$ instead of $min(i,k)$, and (as egreg mentioned in a comment) there is a pair of $ missing from the last line of the algorithm. \documentclass{article} \usepackage{algorithmic} \begin{document} \begin{algorithmic} \FOR {$i\gets0$to$n$} \FOR {$j \gets$0 \TO$\min(i,k)$} \IF {$j=0$\OR$j=i$} \STATE$C[i,j] \gets  1$\ELSE \STATE$C[i,j] \gets  C[i-1,j-1]+C[i-1,j]$\ENDIF \ENDFOR \ENDFOR \RETURN$C[n,k]$\end{algorithmic} \end{document}  • You're missing two $ signs in the last line. – egreg Mar 28 '14 at 14:09