1 {Podprogram} 2 3 {Ex=1+x/1+x2/2+x3/3+......+Xn/n} 4 5 var x:real; 6 7 function E_NA_X(x:real):real; 8 var clen,vysl:real; 9 i:integer; 10 11 begin 12 clen:=1; vysl:=1; i:=1; 13 repeat 14 clen:=clen*x/i; 15 inc(i); 16 vysl:=vysl+clen 17 until abs(clen)<0.00001; 18 e_na_x:=vysl; 19 end; 20 21 22 begin 23 repeat 24 write('x= '); readln(x); 25 writeln('e^x= ',E_NA_X(x):25:6,' =? ',exp(x):25:6); 26 until x=0; 27 end.