Created
May 14, 2018 20:19
-
-
Save FlandreDaisuki/84d245ea8e94a3d7bd440b330952a93d to your computer and use it in GitHub Desktop.
Can input a digit character and print the triangle
This file contains hidden or 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
>++++++[<+++++++>-] | |
++++++++++> | |
, | |
>++++++[<-------->-]< | |
[ | |
>+ | |
[ | |
>+>+<<- | |
] | |
>> | |
[ | |
<<+>>- | |
] | |
< | |
[ | |
<<<<.>>>>- | |
] | |
<<<. | |
>- | |
] |
This file contains hidden or 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
>++++++[<+++++++>-] # [0] = 42 == '*' | |
++++++++++> # [1] = 10 == '\n' | |
, # [2] stdin # accept '0'~'9' | |
>++++++[<-------->-]< # [2] -= 48 # char - '0' | |
[ # while([2]) { | |
>+ # [3]++ | |
[ # while([3]) { # | |
>+>+<<- # [4]++,[5]++ # | |
] # [3]-- # | |
>> # } # assign [4] from [3] | |
[ # while([5]) { # | |
<<+>>- # [3]++ # | |
] # [5]-- # | |
< # } # | |
[ # while([4]) { | |
<<<<. # print([0]) | |
>>>>- # [4]-- | |
] # } | |
<<<. # print([1]) | |
>- # [2]-- | |
] # } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment