function n=priklad3(val)
%n=priklad3(val)
%vypocte, kolik clenu musime nejmene secist, aby mel castecny soucet harmonicke rady
%hodnotu alespon val

s_n = 0;
n = 0;
while s_n < val
    n = n + 1;
    s_n = s_n + 1 / n;    
end

fprintf('Nejmensi castecny soucet s hodnotou nad %f dostaneme pro n = %d, pricemz s_n = %f.\n', val, n, s_n)

% konec
    