MATLAB: How to prevent addition from showing up in command window

addition

I ran some code and am having trouble with the results of the code come out like this:
995
996
997
998
999
1000
How do I just get 1000 instead of all of the numbers? I have suppressed literally everything in the code.

Best Answer

If you get only 1000, you can try following script.
N=10;
err=1;
while err>10^-3
N=N+1;
total=0;
for n=1:N
y=1/n^2;
total=total+y;
end
err=((pi^2)/6)-total;
end
disp(N);
Is the intent of the question I understood fit?
 
Regards,
stozaki