home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 June
/
PCWorld_1998-06_cd.bin
/
software
/
Programy
/
Ozogan
/
REKURZE.IPS
< prev
next >
Wrap
Text File
|
1998-03-25
|
669b
|
20 lines
FUNCTION factorial(n: real): real;
IF (n = 0) then
factorial := 1
ELSE
factorial := n*factorial(n-1);
ENDIF
ENDFUNC;
PROCEDURE main
ConsoleClear; ConsoleShow;
WRITELN('Test rekurze:');
WRITELN('faktorißl Φφsla 1 je:', factorial(1):5); { 1}
WRITELN('faktorißl Φφsla 2 je:', factorial(2):5); { 2}
WRITELN('faktorißl Φφsla 3 je:', factorial(3):5); { 6}
WRITELN('faktorißl Φφsla 4 je:', factorial(4):5); { 24}
WRITELN('faktorißl Φφsla 5 je:', factorial(5):5); { 120}
WRITELN('faktorißl Φφsla 6 je:', factorial(6):5); { 720}
WRITELN('faktorißl Φφsla 7 je:', factorial(7):5); {5040}
ENDPROC;