Try hoisting everything you can out of the if statements - first off the assignment to y is the same whatever values you're using:
for (int j=0; j<900; j++)
{
y = j/30;
if ( j == 0)
{
x = 0;
}
else if ( j >= 1 && j <= 29 )
{
x = j;
}
else if ( j >= 30 && j <= 59 )
{
x = j-30;
}
}
Then either notice that you're subtracting 30 * y off j to get x:
for( int j = 0; j < 900; j++ )
{
y = j / 30;
x = j - y * 30;
}
or use nested loops the way Christian suggested.
Admittedly most compilers would probably notice that the loop is a very bad way of saying:
y = x = 29;
but I'll assume that x and y are just placeholders for something for now.
Cheers,
Ash