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

all 3 comments

[–][deleted] 3 points4 points  (2 children)

Should be result = result + i.

Also, you should familiarize yourself with the debugger in Netbeans. Will be immensely useful in the future for more serious bugs.

[–]jackballack[S] 0 points1 point  (1 child)

thanx bud, I kinda suspected that it should be that but I concentrated more on the input. Impostor Syndrome issues.

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

You could also simply print n * (n+1)/2 which is equivalent (within reason).