% hw0092.m
% John Burkardt
% Estimate probability a "random" quadratic equation has real roots.
%
n = input ( 'Enter number of tests N: ' );
m = 0;

for i = 1 : n
  a = rand ( );
  b = rand ( );
  c = rand ( );
  if ( b^2 - 4 * a * c >= 0.0 )
    m = m + 1;
  end
end
fprintf ( 'Estimated probability of real roots is %g\n', m / n );
