Errr...something's up with your CPU or with your program, if that's the answer you're getting back. Possibly you're passing printf an invalid format specifier (but the format specifier is correct on my system, so...?) Either that or my reasoning is somehow off (see my reasoning below).
See, the square root of the maximum counter in all that is 10,000. So the square root of any number before the final counter will be less than 10,000. But let's be generous and assume that every square root is indeed 10,000.
This means we will have 100,000,000 square roots, all equalling 10,000. Which, added together, will produce a total answer of 1,000,000,000,000.
1,000,000,000,000 < 21,081,851,083,600 (obviously)
And we know that the <i>real</i> total will be less than 1,000,000,000,000, seeing as we were so generous in our square-root estimate above. In reality there will be many, many square roots below 10,000.
So what gives?
Oh, my system completed the whole thing in less than ten seconds. The fact that the 80387 and higher FPU's have a built-in FSQRT instruction may explain that...
My system got an answer of 666,666,671,666.612061.
Kelledin
bash-2.04$ kill -9 1
init: Just what do you think you're doing, Dave?