I need to print a 5x5 table with alphabets in them, for example:
<table>
<tr> <td>A</td> <td>B</td> <td>C</td> <td>D</td> <td>D</td>
etc. the letters are actually a link, so they will be like this:
<td> <a href='/someplace'>A</a> </td>
These links tend to change frequently, and I don’t want to hardcode and replace them, as they will appear on several pages. So I decided to write a function to output the whole structure.
Yes, this is pretty straight forward, make the loop forbehave like this:
StringBuilder alphabets = new StringBuilder("<table class='table'>");
for(int i=65; i<=87; i++)
{
}
Then it hit me, I could do it better, in a "smart" way, using nested for loops,
for(i=1; i<=5; i++)
{
alpbahets.Append("<tr>")
for(j=1; j<5; j++)
{
}
alphabets.Append("</tr");
}
Now the question is, what can I do to bind iAND jto get them in the range 65-87?
(AW, since this is a 5x5 grid, I will skip the last iteration and manually add YZto one td).
(i*10 + j) + 54) (, , ), .
, , for? ? , ( , ).