title: Latex algorithm - IF-ELSE - IF shows end before begins ELSE
body: <p>As you see in my latex it shows end after If statement which supposes to end after Else. I tried removing the curly braces of the IF but it does not work.</p>
  <pre><code>\documentclass[journal]{IEEEtran}
  \ifCLASSINFOpdf
  \usepackage[pdftex]{graphicx}
  \usepackage[dvips]{graphicx}
  \usepackage{graphicx}
  \usepackage{xcolor}
  \usepackage{amsfonts}
  \usepackage{amssymb,mathtools}
  \usepackage[linesnumbered,ruled,vlined] {algorithm2e}
  \usepackage{nomencl}
  \usepackage{algpseudocode}
  \usepackage{algorithm}
  \hyphenation{op-tical net-works semi-conduc-tor}
  
  \begin{document}
  
  
  \begin{algorithm}
      \caption{PEC, \texttt{PEC}}
      \SetAlgoLined
      \DontPrintSemicolon
      \textbf{Input:} I, P, C.
      
      
      \textbf{Output:} Set of $PS^*$= $\{{PS_{1},PS_{2}, ...,PS_{n}}\}$ 
      
      //Initialization
      
      \quad \quad \quad $PS^* \gets \emptyset$
      
      
      \For  {each, $i \in I$} {
          // Calculate
          
          $PS^{temp}_{i} \gets P$
          
          $PS^{loss}_{i} \gets C)$
          
          \If { $ C_{i}- P_{i} &gt; 0$}{
              
              $PS_{i} \gets $($PS^{temp}_{i} - PS^{loss}_{i}$)
              
          }
          \Else {
              $PS_{i} \gets 0$
          }
      }
  
      
      return ($PS^*$)
      
      \label{alg:PoEG}
  \end{algorithm}
  
  
  \end{document}
  </code></pre>
  <p>The output for this problem is as follows, as you see the highlighted <strong>end</strong>, which I need to eliminate.</p>
  <p><a href="https://i.stack.imgur.com/fAZvu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fAZvu.png" alt="enter image description here" /></a></p>