% area.m
% Seek the square root of the number A, using NSTEPS steps.
%
A = input ( '  Enter A, the area, or number whose square root is needed:');
nsteps = input ( '  Enter NSTEPS, the number of steps to take: ' );

L = A;
W = A / L;

for k = 1 : nsteps
  L = ( L + W ) / 2;
  W = A / L;
end

fprintf ( '  Estimated square roots of %g are %20.16g and %20.16g\n', A, L, W );
