2015-08-09 19:43:47 +00:00
|
|
|
|
2015-08-10 15:05:58 +00:00
|
|
|
VAR res : INT;
|
2015-08-09 19:43:47 +00:00
|
|
|
|
2015-08-10 11:55:52 +00:00
|
|
|
PUB main(x : INT) → c : INT
|
2015-08-10 14:37:16 +00:00
|
|
|
BEGIN
|
2015-08-10 15:05:58 +00:00
|
|
|
factorial(10) → res;
|
|
|
|
END
|
|
|
|
|
|
|
|
PUB factorial(number : INT) → result : INT
|
|
|
|
BEGIN
|
|
|
|
1 → result;
|
|
|
|
IF number > 1 THEN
|
|
|
|
number * factorial(number - 1) → result;
|
2015-08-10 14:37:16 +00:00
|
|
|
END
|