title: Java: Calculate for loop
body: <p>I've now googled around and tried various methods myself without any success.
  So to the problem,
  I've got this loop, I type in a number "n" ex. 10. Then the program counts from 1 to 10.
  This is the loop I'm using. </p>
  
  <pre><code>n = Keyboard.readInt();
  for(int e = 1; e &lt;=n; e++)          
  System.out.println(e);  
  </code></pre>
  
  <p>That works fine, but now I want to calculate the numbers that has been shown in loop so..It would be 1+2+3+4+5+6+7+8+9+10 (If 'n' was chosen as number 10) and it should give the calculation of that so it would say 1+2+3+4+5+6+7+8+9+10 = 55.</p>
  
  <p>Would be great if anyone here could help me.</p>
  
  <p>Thanks in advance,</p>
  
  <p>Michael.</p>