x=input('enter how close you want to get to e with (1+1/n)^n') u=exp(1); count=0; y=1; while (abs(y-u)>=x) count=count +1; %y=sum from 0 to count of 1/(n!) sumo=0; for ii = 0:count sumo=sumo+(1/factorial(ii)); end y=sumo; end fprintf('we needed %d computations to get within %f of e\n',count,x)