This just so happened to turn out this way because you used two equal values being 10. If you would have used lets say 18 & 34, then it would probably have been much more evident.
In any case;
1 2 3
z = 0;
for ( int k = 0; k < y; k++ )
z += pi;
y is not including x and that is why your off by one decimal.
Enclosing code with code tags
would have been easier to point out error by line number.