Skip to main content

Debugging (mentally) does away with most woes...

Blindfold chess is supposed to be an art.

Consider this problem...

What letter is generated by the code below : A / X / J / S ?

for (int i=1; i<6; i++)
{
for (int ii=1; ii<6; ii++)
{
if (((i==ii) || ((i+ii)=6))
{
Console.Writeline("*");
}
else
{
Console.Writeline(" ");
}
}
}

Can you solve this mentally?

To do so consider a 5x5 table like the one below :

*

 

 

 

*

 

*

 

*

 

 

 

*

 

 

 

*

 

*

 

*

 

 

 

*



Put an asterisk in the appropriate cells and you will get the pattern above. Nice ain't it?

Comments