Answers for "multiplication in brainfuck"

1

multiplication in brainfuck

#Two digit multiplication in brainfuck
#
#Takes 2 two digit numbers
,>,>+++++ +[<----- ---<----- --->>-]<<
[>+++++ +++++<-]>
[<+>-]
,>,>+++++ +[<----- ---<----- --->>-]<<
[>+++++ +++++<-]>
[<+>-]<
#Duplicates the second
[>+>>+<<<-]>>>
[<<<+>>>-]<<<<
#Adds the seccond number to the output cell then duplicates the seccond number
#back into the cell, removes one from the first number then repeats till it's 0
[>[>>+<<-]>[<+>>>+<<-]>>[<<+>>-]<<<<-]
#Cleans up the left over numbers
>[-]>[-]>
#Repositions the result
[<<<+>>>-]<<<
#Prints the result to the screen
[>>+>+<<<-]>>>
[<<<+>>>-]<<
+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]++++++++[<++++++>-]>[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<
[.[-]<]<
#Removes the result
[-]
Posted by: Guest on July-24-2021

Browse Popular Code Answers by Language