title: Finding integers that are divisible by 6 or 7 but not both
body: <p>I am trying to write a program that displays the integers between 1 and 100 that are divisible by either 6 or 7 <strong>but not both</strong>.</p>
  
  <p>Here is my code: </p>
  
  <pre><code>import acm.program.*;
  
  public class Problem4 extends ConsoleProgram
  {
      public void run()
      {
          for (int i = 1; i &lt;= 100; i++)
          {
              boolean num = ((i % 6 == 0) || (i % 7 == 0));
  
              if (num == true)
              println(i + " is divisible");
          }
      }
  }
  </code></pre>
  
  <p>The above code shows the following answers:
  6,7,12,14,18,21,24,28,30,35,36,<strong>42</strong>,48,49,54,56,60,63,66,70,72,77,78,<strong>84</strong>,90,91,96,98</p>
  
  <p>Now the bold numbers 42 and 84 are both divisbile by 6 and 7. Now If I change the <code>||</code> to <code>&amp;&amp;</code> in the above code, the result shows only 42 and 84. </p>
  
  <p>What change should I do to remove these 2 numbers from the final result?</p>