PROGRAM BILANGAN_FAKTORIAL_PROCEDURE;
USES WINCRT;
PROCEDURE FAKTORIAL (VAR B:INTEGER; VAR HSL:INTEGER);
VAR I:INTEGER;
BEGIN
CLRSCR;
HSL:=1;
FOR I:=B DOWNTO 1 DO
HSL:=HSL*I;
END;
{PROGRAM UTAMA}
VAR BIL,HASIL:INTEGER;
BEGIN
CLRSCR;
WRITE('INPUT BILANGAN : ');READLN(BIL);
FAKTORIAL(BIL,HASIL);
WRITELN(BIL,'! = ',HASIL);
READLN;
END.
0 comments:
Post a Comment