function approximate_e()

% Initializing values
tolerance = 0.001         ;
iteration = 0             ;

% Approximating e
while true
    
    % Updating iteration coutner
    iteration = iteration + 1;
    
    % Approximating e with current natural number
    approximation = ( 1 + 1/iteration )^iteration ;
    error         = abs( approximation - exp(1) ) ;
    
    % Testing convergence criteria
    if error<tolerance
        break
    end
    
end

fprintf('Convergence criteria satisfied after %d iterations.\n', iteration)


end