
tol=5e-6;

sum=0;
k=0;

while abs(sum - pi^2/6) > tol
     k = k + 1;
     sum = sum + 1/k^2;
end

format long;
disp(k)
disp(sum)