Why is the for-loop choosing the wrong IF statement path? : <p>So I am doing an online coding challenge and have come across this issue that has me stumped:</p>

<p>This is my code:</p>

<pre><code> static void Main(String[] args)
        {
            int noOfRows = Convert.ToInt32(Console.ReadLine());

            for (int i = 0; i &lt; noOfRows; i++)
            {
                string odds = "";
                string evens = "";

                //get the input word from console
                string word = Console.ReadLine();

                for (int j = 0; j &lt; word.Length; j++)
                {
                    //if the string's current char is even-indexed...
                    if (word[j] % 2 == 0)
                    {
                        evens += word[j];                       
                    }
                    //if the string's current char is odd-indexed...
                    else if (word[j] % 2 != 0)
                    {
                        odds += word[j];
                    }                   
                }
                //print a line with the evens + odds
                Console.WriteLine(evens + " " + odds);
            }
        }

</code></pre>

<p>Essentially, the question wants me to get the string from the console line and print the even-indexed characters (starting from index=0) on the left, followed by a space, and then the odd-indexed characters.</p>

<p>So when I try the word 'Hacker', I should see the line printed as "Hce akr". When I debugged it, I saw the code successfully put the letter 'H' on the left (because it is index=0, thus even), and put the letter 'a' on the right (odd index). But then when it got to the letter 'c', instead of going through the first IF path (even index), it skips it and goes to the odd index path, and places it on the right hand side?</p>

<p>The funny thing is when I try the word 'Rank' it works fine and prints the correct statement: "Ra nk", yet other words do not.</p>

<p>Its just bizarre that I'm getting different results.</p>

<p>What am I missing?</p>
