
tol=5e-6;

sum=0;
k=1;

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

format long;
disp(k-1)
disp(sum)