v=input('Give v0:');
h=input('Give h0:');
S = [-9.8/2, v, h];
y = roots(S);
if y(1) >= 0
    t=y(1);
else
    t=y(2);
end
DS=polyder(S);
DSroots=roots(DS);
    if DSroots(1)<0
        maxh=h;
    else    
        maxh=polyval(S,DSroots);
    end 

    disp(['The object will hit the ground in ', num2str(t),' seconds'])
    disp(['The maximum height of the object is ', num2str(maxh),' meters'])

%   fprintf('The object will hit the ground in %.2f seconds\n', t)
%   fprintf('The maximum height of the object is %.2f meters\n', maxh)





