{ FAKTORIA.PAS Copyright (c) TrSek alias Zdeno Sekerak } { Vypocita faktorial cisla } { Vstup : cele cislo } { Vystup: faktorial cisla } { } { Datum:10.04.2000 http://www.trsek.com } program faktorial; var a,h,e:real; i:integer; n:real; procedure clrscr; var i:integer; begin for i:=1 to 25 do begin writeln(' '); end; end; function ano:boolean; var o:char; begin write(' Chces este raz ? :'); readln(o); if (o='n') or (o='N') then ano:=false else ano:=true; end; begin repeat clrscr; writeln(' Vypocet faktorialu podla TRSEK-a.'); write('Zadaj cislo n:'); readln(n); a:=0; for i:=1 to round(n) do a:=a+ln(i); e:=round(a/ln(10)-0.5); h:=exp(a-(e*ln(10))); if (e<36) then writeln('Faktorial cisla ',n:8:0,'!=',exp(a):16:0) else writeln('Faktorial cisla ',n:8:0,'!=',h:2:10,' * 10^',e:4:0); until not(ano); end.