i'm trying to get java code to print exactly what is below but apart from the 4rth line( 2 1).
1 1
1 2
1 3
2 1 //problem here, i don't want 2,1
2 2
2 4
2 6
2 8
3 1
3 2
3 3
does anyone know what i need to change in my code?
Thanks!!
class ForLoop
{
public static void main(String[] args)
{
for(int i = 1; i < 4; i++)
{
for(int j = 1; j < 4; j++)
{
System.out.println(i+" "+j);
if(i == 2)
{
for (j = 2; j<9; j=j+2)
System.out.println(i+" "+j);
}
}
}
}
}
2007-03-17
05:54:42
·
3 answers
·
asked by
Anonymous
in
Computers & Internet
➔ Programming & Design