/programy/pascal/zaklady/FAKTORIA.PAS |
---|
0,0 → 1,33 |
program ahoj; |
uses crt; |
var |
x,fact: double; |
begin |
clrscr; |
write ('Yadejte cele cislo: '); |
readln(x); |
fact:=1; |
if(x>=0) then |
begin |
while ((x>1)) do |
begin |
fact := fact * x; |
x := x - 1; |
end; |
writeln ('faktorial cisla je:', fact:10:0); |
end |
else |
begin |
writeln('Faktorial zaporneo cisla neni definovan'); |
end; |
readkey; |
end. |