How would I put the output is rows of ten?

public static void main(String[] args) {

        int count = 1;
        int j = 0;
        // for (the numbers from 100 to 200)
            for (int i = 100; i <= 200; i++)
            // if (this number is divisible by 5 or 6, but not both)
                if (((i % 5 == 0 ? 1 : 0) ^ (i % 6 == 0 ? 1 : 0)) != 0)

                // Display this number (ten per line): System.out.print
                    System.out.print(i + " ");
                    j++;

                    if (j % 10 == 0)
                    {
                    System.out.println("\n");
                    j = 0;

                    }
                }
    }

the code you have 'll do that just fine, but you need to look up a bit more about scopes of loops and if statements.

for instance:

if ( isValid())
  System.out.println("it is valid");
  System.out.println("it is valid 2");

is not the same as:

if ( isValid()){
  System.out.println("it is valid");
  System.out.println("it is valid 2");
  }

nor as:

if ( isValid());
  System.out.println("it is valid");
  System.out.println("it is valid 2");

there are two ways such structures (or the influence of them) can end.
1. if you used {}, the scope of that statement or iteration ends at the right closing bracket.
2. if you didn't, the very first ; will terminate it.

in my first example: the first line will only be printed if isValid() returns true. the second line 'll always be printed.
in the second example: both lines 'll only be printed if isValid() returns true
in the third example: both lines 'll be printed no matter what the result of isValid() is.

conclusion: add brackets for your if-statement and your for loop.

yea it looks like you are missing some brackets for the first if statment. If you have a single if statment like this:

if(condition)
    statement 0

statement 1
statement 2

statement 0 will be executed only if the if statement is true, however statemen 1 and 2 will always be executed even if the if statement is false because you don't have brackets. but if you had this

if(condition){
    statement 0
    statement 1
    statement 2
}

Now all three statements will execute if the condition is true

way to repeat what I've said. anyway ... not really. depends on how you chain your statements. it's only when the first ; is encountered that it would stop.

This article has been dead for over six months. Start a new discussion instead.