Rendering out a table
<p>I'm working on an application for converting Celsius to Fahrenheit and vice versa.</p>

<p>The application contains of fields and radiobuttons. The user fills in "start temperature", "end temperate" and "iterator" and chooses to convert from C to F or F to C.</p>

<p>After clicking a button a table is rendered showing the temperature in C and the converted temperature in F (or vice versa). I've tried to do it with a while-loop as well as a for loop, but it doesn't work as it shall.</p>

<p>I know that it is an unnecessary complex solution, and I really should appreciate help with creating a more elegant solution, that works.</p>

<pre><code>        var i = 0;

        while (startTemp &lt; endTemp) {
            i += 1;

            TableRow tRow = new TableRow();
            tRow.CssClass = (i % 2 == 0 ? "white" : "grey");
            tempTable.Rows.Add(tRow);

            startTemp = startTemp + iterator;
            if (startTemp &lt; endTemp) {
                for (int j = 0; j &lt;= 1; j++) {
                    TableCell tCell = new TableCell();
                    if ((j % 2) == 0) {
                        tCell.Text = startTemp.ToString();
                    }
                    else {
                        if (tempType1 == "°C") {
                            convertedTemp = TemperatureConverter.CelsiusToFahrenheit(startTemp);
                        }
                        else {
                            convertedTemp = TemperatureConverter.FahrenheitToCelsius(startTemp);
                        }
                        tCell.Text = convertedTemp.ToString();
                    }
                    tRow.Cells.Add(tCell);
                }
            }
</code></pre>

<p>Wanted output (iterator = 2):</p>

<p>C--------------------F</p>

<pre><code>39          102 
41          105 
43          109 
45          113 
47          116 
49          120 
</code></pre>

<p>EDIT: The solution works fine, except for one thing. If I use 1 as start temp, 10 as end temp and 1 as iterator, it stops at 9 (not at 10 as it should), and I just can't figure out why.</p>
