将十进制转化为八进制的算法
Converting a number from Decimal to Octal is almost similar to converting Decimal into Binary, although just one difference is that unlike Binary conversion, here in an integral part, we successively divide the number by 8 until the quotient is 0 (the last remainder becomes the MSB). The remainders read from bottom to top give the equivalent octal integer number. and in the fractional part, we multiply it by 8 till the fractional part of the product is 0. The first integer in the product term gives the MSB, thus the integers read from top to bottom gives the equivalent octal fraction.
将数字从十进制转换为八进制几乎类似于将十进制转换为二进制 ,尽管唯一的区别是与二进制转换不同,在整数部分中,我们将数字连续除以8直到商为0(最后的余数变为MSB)。 从下到上读取的余数给出等效的八进制整数。 在小数部分中,我们将其乘以8,直到乘积的小数部分为0。乘积项中的第一个整数给出MSB,因此从上到下读取的整数给出等效的八进制小数。
Same as in decimal to binary conversion, to convert a mixed decimal number into octal, we first separate the integral and the fractional part and then convert them into octal individually, after converting both to octal separately, we combine them back together to get the desired result.
与