program Faktorial;
uses wincrt;
procedure faktorial (var fak, hasil : integer);
var
i:integer;
begin
hasil := 1;
for i := 2 to fak do
hasil := Hasil * i;
End;
Var
N,Hasil_fak:integer;
Begin
Write ('Nilai yang akan difaktorialkan = '); Readln (N);
Faktorial (N,Hasil_Fak); Writeln;
Writeln ('Hasil Faktorial = ',Hasil_fak);
End.
Sumber
No comments:
Post a Comment