title: For loops and divisibility of numbers
body: <p>I've been learning java for about a week now and have been messing around with <code>for</code> loops for the last few days. I have used <code>if</code> statements to test the divisibility of a number on several properties. below is what I've got so far.</p>
  
  <pre><code>int g = 18;
  
  if ((g % 2 )== 0 &amp;&amp; (g % 3)== 0)
  {
      System.out.println("g is divisible by 2 and 3");
  }
  else
  {
      System.out.println("g is not divisible by 2 and 3");
  }
  
  if ((g % 7 )== 0 || (g % 9) == 0)
  {
      System.out.println("g is divisible by 7 or 9");
  }
  else
  {
      System.out.println("g is not divisible by 7 or 9");
  }
  
  if (((g % 2 )== 0) &amp;&amp; ((g % 3) == 0) &amp;&amp; ((g % 5) != 0))
  {
      System.out.println("g is divisible by 2 and 3 but 5");
  }
  else
  {
      System.out.println("g is not divisible by 2 and 3 but 5");
  }
  </code></pre>
  
  <p>I am trying to use a <code>for</code> loop to amend each of the programs above to test all of the numbers between 1 and 100 in a single run of each program. Below is my <code>for</code> statement.</p>
  
  <pre><code>for(g=1;g&lt;=100;++g)
  </code></pre>
  
  <p>Trouble is, my program doesn't even run. Have I got it completely wrong? A point in the right direction will be appreciated. Many thanks.</p>