% Example 9.2c (Physics 330) clear s=0; % initialize the sum variable % start of the loop for n=1:1000000 term=1/n^2; % add 1/n^2 to s until the condition is met s=s+term; if term < 1e-10 break end % end of the loop end fprintf(' Sum = %g \n',s)