title: Project Euler #1 in Java
body: <p>I'm having problems with this code. I don't want to look at others, so I'm wondering what's wrong with mine. </p>
  
  <p>If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.</p>
  
  <p>Find the sum of all the multiples of 3 or 5 below 1000.</p>
  
  <pre><code>public class Multiples {
      public static void main (String [] args) {
          int temp = 0;
          int temp2 = 0; 
  
          for (int i = 0; i &lt;= 1000; i++) {
              if (i % 3 == 0) {
                  temp = temp + i;
              }            
          }
  
          for (int j = 0; j &lt;= 1000; j++) {
              if (j % 5 == 0) {
                  temp2 = temp2 + j;
              }
          }
  
          System.out.println(temp + temp2);
      }
  }
  </code></pre>
  
  <p>The value I get is 267333, which is wrong. Is my adding wrong? I know algorithmically, this code might not be up to par, but it should work, right? </p>