# Got error in algorithm

\RequirePackage{amsmath}

\setcounter{tocdepth}{3}

\usepackage{graphicx}

\usepackage{amssymb}

\usepackage{algorithm}

\usepackage{algorithmicx}

\usepackage{algpseudocode}

\usepackage{titleps}

\usepackage{url}

\begin{document}
\begin{algorithm}
\caption{GroupAuth\_KeyExch(Group, 1, n)}
\begin{algorithmic}
Let’s assume Group = \{UE1, UE2, … , UEn\} and n represents the number of groups.
Aim of this algorithm is to authenticate all the devices and establish a session key for the defined Group.
\{
for i = 1 to n do
\{
Recive\_Msgi1 = null;
Recive\_Msgi2 = null;
Obtained\_Keyi = False;
\}
\end{algorithmic}
\end{algorithm}
\end{document}


got this error

• Are you using \usepackage{algorithmic} or \usepackage{algpseudocode}? – Werner Oct 3 '16 at 7:53
• As always please give us a compilable code, not only code snippet(s) ... – Mensch Oct 3 '16 at 8:26
• ya i used those packages and its a paper unable to give fully – Prasad Oct 3 '16 at 8:38
• @Prasad hence the term minimal example, for such a document. Make a smaller document with a representative preamble and document class, then post it here. Then others can copy and test your example as is without having to add anything or have to guess what is in your preamble. – daleif Oct 3 '16 at 8:46
• @daleif i did my best but i dont know how to format it here as tex code – Prasad Oct 3 '16 at 8:51

You are probably looking for something like this. Yes, this syntax can be quite cumbersome. Sometimes it might be easier to write it in a verbatim like environment instead

    \begin{algorithmic}
\State Let’s assume Group = \{UE1, UE2, … , UEn\} and n represents the number of groups.
\State Aim of this algorithm is to authenticate all the devices and establish a session key for the defined Group.
\For{i = 1 to n}
\State \{
\State Recive\_Msgi1 = null;
\State Recive\_Msgi2 = null;
\State Obtained\_Keyi = False;
\State \}
\EndFor
\end{algorithmic}