title: Incorrect comparison of three input characters
body: <p>I have the following program, which compares three characters and outputs their comparison.</p>
  <p>When I run the program, whenever I input three integers only the last else (all initials are different) statement runs correctly for its condition. But, for other conditions, only the last else if (first and last initials are the same) runs. I also checked it after adding curly braces but nothing changed.</p>
  <pre><code>    #include&lt;stdio.h&gt;
      #include&lt;stdlib.h&gt;
  
      int main()
      {
      char ch1, ch2, ch3;
  
      printf(&quot;Enter 3 character values into ch1, ch2, and ch3: &quot;);
      scanf(&quot;%c%c%c&quot;, &amp;ch1, &amp;ch2, &amp;ch3);
  
      if(ch1==ch2)
      {
        if(ch2==ch3)
        printf(&quot;All initials are the same!\n&quot;);
  
        else
        printf(&quot;First two initials are the same!\n&quot;);
       }
   
      else if(ch2==ch3)
      {
      printf(&quot;Last two initials are the same!\n&quot;);
      }
    
      else if(ch1==ch3)
      {
      printf(&quot;First and last initials are the same!\n&quot;);
      }
    
    
      else
      {
      printf(&quot;All initials are different!\n&quot;);
      }
   
     
      system(&quot;pause&quot;);
      return 0;
      } 
  </code></pre>