This program (in C) doesn’t output what I’d expect:
int main()
{
int i, j ;
for ( i = 1 ; i <= 2 ; i++ )
{
for ( j = 1 ; j <= 2 ; j++ )
{
if ( i == j )
continue ;
printf ( "\n%d %d\n", i, j ) ;
}
}
}
I think it should be
1 2 1 3 2 1 2 3
But the program outputs
1 2 2 1
Why is this?
Number 3 cannot be ever reached by the loops’ indices.