forked from ZoranPandovski/al-go-rithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e7f016
commit 6424261
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
read n (leave some free space to stop the final loop) | ||
>>,>++++++++[-<------>] | ||
generate all integers from n to 0 separated by 0 | ||
<[[->+>+<<]>[-<+>]>-] | ||
set result to 1 and move to integer '1' | ||
<+< | ||
While current integer is not null | ||
[ | ||
multiply result by current integer | ||
[->[->+>+<<]>[-<+>]<<] | ||
store result at its new location (and reset temporary cells) | ||
>>>[-<<<<+>>>>]<<[-]< | ||
go to previous integer in the stack | ||
<<] |