Learn

We convert decimal to octal in the same way we convert decimal to binary. We can use the division method with the base of 8 and reverse the numbers at the end. We start with the decimal number and divide iteratively by eight and keep the remainders. For example, for the decimal number 112:

Division by 8 Remainder
112 / 8 = 14 0
14 / 8 = 1 6
1 / 8 = 0 1

Read from bottom to top and calculate the new octal number 0o160. As a check, we notice our decimal number was even, as is our octal number.

Instructions

1.

Convert the decimal number 326 to octal using the division technique.

Assign the value to checkpoint_1 in the code editor. Be sure to include any necessary prefix.

2.

Convert the decimal number 87 to octal using the division technique from the exercise.

Assign the value to checkpoint_2 in the code editor. Be sure to include any necessary prefix.

3.

Convert the decimal number 999 to octal using the division technique from the exercise.

Assign the value to checkpoint_3 in the code editor. Be sure to include any necessary prefix.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?