Revision 9bcfde41-3c7e-45a7-a556-06403d957e2f - Code Golf Stack Exchange

#[OIL](https://github.com/L3viathan/OIL), <s>134</s> 106 bytes

Takes the input from stdin, the two numbers seperated by a newline. Outputs the result of the integer division, then a newline, and then the remainder.

This is one of the most complicated OIL programs I've ever written, as OIL lacks builtins for division, remainder, addition, substraction, and so on. It works with the primitive way of doing division: repeated nested decrementation.

I present the code in an annotated format, with comments in the style of scripting languages. Before executing, the comments have to be removed.

 5 # read input into lines 0 and 2
 0
 5
 2
 1 # make a backup of the second input at line 3
 2
 3
 10 # check if the second input is 0. %
 18
 2
 23 # if so, jump to 23 (marked with §)
 12 # else, go on
 10 # check if the first input is zero &
 18
 0
 30 # if so, jump to 30 (marked with $)
 17 # else, go on
 9 # decrement both numbers
 0
 9
 2
 6 # jump to line 7 (marked with %)
 7
 8 # increment the value in line 1 (initially a zero) §
 1
 1 # "restore the backup"
 3
 2
 6 # jump to line 12 (marked with &)
 12
 10 # is the second number zero? $
 18
 2
 41 # if so, jump to 41 (marked with +)
 35 # else go on
 9
 2
 9
 3
 6
 30
 4 # print the division +
 1
 11 # a newline
 4
 3 # and the remainder (from the backup)

AltStyle によって変換されたページ (->オリジナル) /