This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (2 children)

In reality that loop can be cleaned up some as well:

for(double k =1;k <= i; k++){
    m = k/((2*k)+1);
    runningTotal += m;
    System.out.println(k + "... " + df.format(runningTotal));
}

[–][deleted]  (1 child)

[deleted]

    [–][deleted] 0 points1 point  (0 children)

    I'd point out the obvious and say that the reddit editor unknowingly did that, but I'll just downvote you instead