Modify solution to use a single loop
<p>I managed to solve this, below is my solution :</p>

<pre><code>public class ProblemA001k {

public static void main(String[] args) {



        System.out.println("Sum from 1" + " to " + divQ + ":" + sum2);
        System.out.println();
        divQ += q;
        newQ += q;
        sum1 = 0;
        sum2 = 0;
        }

key.close();
}
</code></pre>

<p>}</p>

<p>Now I was told to modify my solution so that it uses ONLY ONE LOOP.
I have 3 loops in the code above, even when I tried using only 2 loops I  struggled. but ONE LOOP ? I don't know how to improve my code. Please help me.</p>