Yes that code uses different signs.
But the whole of the code does not follow the equation and produce the correct answer.
Add a println after each of those assignments to print out the value of var.
Shorten the loop to 10 times and look at the output
NormR1 563 Posting Sage Team Colleague
ilovejava 0 Junior Poster in Training
NormR1 563 Posting Sage Team Colleague
ilovejava 0 Junior Poster in Training
NormR1 563 Posting Sage Team Colleague
ilovejava 0 Junior Poster in Training
NormR1 563 Posting Sage Team Colleague
ilovejava 0 Junior Poster in Training
NormR1 563 Posting Sage Team Colleague
ilovejava 0 Junior Poster in Training
NormR1 563 Posting Sage Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.