Skip to content

Instantly share code, notes, and snippets.

@FlandreDaisuki
Created May 14, 2018 20:19
Show Gist options
  • Save FlandreDaisuki/84d245ea8e94a3d7bd440b330952a93d to your computer and use it in GitHub Desktop.
Save FlandreDaisuki/84d245ea8e94a3d7bd440b330952a93d to your computer and use it in GitHub Desktop.
Can input a digit character and print the triangle
>++++++[<+++++++>-]
++++++++++>
,
>++++++[<-------->-]<
[
>+
[
>+>+<<-
]
>>
[
<<+>>-
]
<
[
<<<<.>>>>-
]
<<<.
>-
]
>++++++[<+++++++>-] # [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