DECIMAL TO OCTAL

plz help me with this ques…

what problem you are getting in this question

can you share link of your code ?

how to convert decimal to binary?
or can we directly convert binary to octal? if yes, how?

yes decimal to octal can be done directly

it similar to decimal to binary question
instead of 2 divide with 8

Algorithm :

  1. Store the remainder when the number is divided by 8 in an array.
  2. Divide the number by 8 now
  3. Repeat the above two steps until the number is not equal to 0.
  4. Print the array in reverse order now.

image

Reference Code