this method return "StackOverflowException" error for some inputs;like "12"
where is Infinite loop point?
public void cycle(int f){
int i, j;
if (f == 0)
return;
else
{
for (i = f; i >= 0; i--)
{
for (j = 0; j <= 10; j++)
{
if (i == Math.Pow(2, j))
{
f = f - (int)Math.Pow(2, j);
switch (j)
{
case 1:
cbx1.Checked = true;
break;
case 2:
cbx2.Checked = true;
break;
case 3:
cbx3.Checked = true;
break;
case 4:
cbx4.Checked = true;
break;
case 5:
cbx5.Checked = true;
break;
case 6:
cbx6.Checked = true;
break;
case 7:
cbx7.Checked = true;
break;
case 8:
cbx8.Checked = true;
break;
case 9:
cbx9.Checked = true;
break;
case 10:
cbx10.Checked = true;
break;
}
break;
}
}
}
cycle(f);
}
}