% hw030.m
%  A penny drops from the elevation of Blacksburg (2090 feet).
%  Pretend it drops down a well that goes to the bottom of the earth.
%  Ignore the fact that gravity would actually decrease once the penny
%  is inside the earth.  When would the penny reach the center of the earth?
%
t = 0.0;
h = 2090;
target = -20900000.0;
%target = 0;

while ( true )

  y = h - 16.0 * t^2;

  if ( y <= target )
    break
  end

  t = t + 1;

end

fprintf ( '%d seconds, %d feet\n', t, y );
