Convert from Decimal to Octal

Convert from Decimal to Octal

The convertion from decimal to octal can be achived through recursivly dividing the decimal value through 8. Then the integer result of each devision is written down from left to right and the reminder is divided again through 8 until the reminder is zero.

Example: 77 => octal
77 / 8^2 = 77 / 64 = 1 (first oct digit)
77 % 8^2 = 13
13 / 8^1 = 13 / 8 = 1 (second oct digit)
13 % 8^1 = 5
5 / 8^0 = 5 / 1 = 5 (third oct digit)
5 % 8^0 = 0
=> 0o115 (= 77)