Mapping square objects to specific cells in a TableLayoutPanel in WindowsForms game I have solved this problem but I am looking for a better way to do it, in fewer lines of code. 

The problem was from this previous question on Stack Overflow.

My solution:

   /// &lt;summary&gt;
        /// For a given square number, tells you the corresponding row and column numbers.
        /// Pre:  none.
        /// Post: returns the row and column numbers, via "out" parameters.
        /// &lt;/summary&gt;
        /// &lt;param name="squareNumber"&gt;The input square number.&lt;/param&gt;
        /// &lt;param name="rowNumber"&gt;The output row number.&lt;/param&gt;
        /// &lt;param name="columnNumber"&gt;The output column number.&lt;/param&gt;
        private static void MapSquareNumToScreenRowAndColumn(int squareNumber, out int rowNumber, out int columnNumber){

        // ######################## Add more code to this method and replace the next two lines by something more sensible.  ###############################
        rowNumber = 0; // Use 0 to make the compiler happy for now.
        columnNumber = 0; // Use 0 to make the compiler happy for now.

        columnNumber = squareNumber % 6;
        rowNumber = squareNumber/6;

        //switch statement for assigning column values to odd rows
        int remainder = squareNumber%6;
        switch (remainder){
            case 0:
                columnNumber = 5;
                break;
            case 1:
                columnNumber = 4;
                break;
            case 2:
                columnNumber = 3;
                break;
            case 3:
                columnNumber = 2;
                break;
            case 4:
                columnNumber = 1;
                break;
            case 5:
                columnNumber = 0;
                break;

        }

        if (squareNumber &gt;=0 &amp;&amp; squareNumber &lt;= 5){
            rowNumber = 6;
            columnNumber = squareNumber%6;

        }

        if (squareNumber &gt;=6 &amp;&amp; squareNumber &lt;= 11){
            rowNumber = 5;
        }

        if (squareNumber &gt;=12 &amp;&amp; squareNumber &lt;= 17){
            rowNumber = 4;
            columnNumber = squareNumber%6;
        }
        if (squareNumber &gt;=18 &amp;&amp; squareNumber &lt;= 23){
            rowNumber = 3;

        }
        if (squareNumber &gt;= 24 &amp;&amp; squareNumber &lt;= 29){
            rowNumber = 2;
            columnNumber = squareNumber%6;

        }
        if (squareNumber &gt;= 30 &amp;&amp; squareNumber &lt;= 35){
            rowNumber = 1;

        }
        if (squareNumber &gt;= 36 &amp;&amp; squareNumber &lt;= 41){
            rowNumber = 0;
            columnNumber = squareNumber % 6;
        }


    }//end MapSquareNumToScreenRowAndColumn


I'm fairly new to programming, so I just wanted a second opinion on it. Is there a way for me to get the same outcome, but with less code?
The problem of your code is that you use separate conditions for each particular row and for each particular column.
But it can be easily aggregated into one - check if the row number is odd. A rest of the desired functionality can be reached using arithmetics.  

Please try this code:

private static void MapSquareNumToScreenRowAndColumn(int squareNumber, out int rowNumber, out int columnNumber)
{
    const int Rows = 7;
    const int Cols = 6;

    // Calculate the rowNumber and the columnNumber at once.
    // See Math.DivRem for details: http://msdn.microsoft.com/en-us/library/yda5c8dx(v=vs.110).aspx
    rowNumber = Rows - 1 - Math.DivRem(squareNumber, Cols, out columnNumber);

    // If the rowNumber is odd:
    if ((rowNumber &amp; 1) != 0)  // (rowNumber &amp; 1) is the same as (rowNumber % 2)
        columnNumber = Cols - 1 - columnNumber;  // Invert the columnNumber
}