title: How do I calculate the sum of all numbers from 0 to n?
body: <p>So I'm trying to calculate all the numbers from 0 to a given number (n) with a loop as seen in my code but I just can't seem to manage how.</p>
  
  <pre><code>public static int sumOfNumbers(int... params) {
  
       int sum = 0;
  
       for (int i : params) {
           sum = i;
       };
  
       return sum;
  }      
  </code></pre>