 <pre><code>static void PrintReport() { int count; fileOut.WriteLine(); fileOut.WriteLine("Score Score Score Score Score"); fileOut.WriteLine("----- ----- ----- ----- -----"); for (int row = 1; row &lt;= numOfRows; row++) { for (int col = 1; col &lt;= numOfCols; col++) { count = row + numOfRows * (col - 1); if (count &lt;= numOfValues) fileOut.Write("{0,5:N2} ", valueArray[count]); } fileOut.WriteLine(); } } </code></pre> <p>this solved my issue</p>