The decimal to octal converter is a lot like the decimal to binary converter at the beginning. This converter was a good preparation for the decimal to hexadecimal converter as it followed a similar form.

The procedure begins with getting the users input. Like the decimal to binary converter before I used a logarithmic function to get largest exponent of eight (8) that is still less than the user input that we will call x (e.g. every number that is greater than 8 and less than 64 would return 1). Now I start a loop that ends when x is zero (0) with each iteration of the loop taking one away from x. During the loop I divide the user input by x to the power of 8 in integer form which is then converted to a string. After the loop is finished I combine these value into one and output it.