Repeatedly divide the number by 8 until the number is zero. Take the remainders from each division (the remainders will always be in the range 0 to 7 inclusive). The first division finds the lowest-order digit, the last finds the highest-order digit.
Example:
Decimal value: 421
421 / 8 = 52 r 5
52 / 8 = 6 r 4
6 / 8 = 0 r 6
The remainders are 6, 4 and 5, so 421 decimal is 645 octal.
To convert from octal to decimal, multiply each octal digit by 8^n, where n is the zero-based order of the digit (0 being the lowest order), then sum the products.
Example:
Octal number: 645
5 * (8^0) = 5 * 1 = 5
4 * (8^1) = 4 * 8 = 32
6 * (8^2) = 6 * 64 = 384
384 + 32 + 5 = 421
Note that n^0 = 1 for all n>=0.
A45C: Decimal = 42076 Octal = 122134
BB895C: Octal = 56704534 Decimal = 12290396
public class Dataconversion { public static void main(String[] args) { System.out.println("Data types conversion example!"); int in = 44; System.out.println("Integer: " + in); //integer to binary String by = Integer.toBinaryString(in); System.out.println("Byte: " + by); //integer to hexadecimal String hex = Integer.toHexString(in); System.out.println("Hexa decimal: " + hex); //integer to octal String oct = Integer.toOctalString(in); System.out.println("Octal: " + oct); } }
void Decimal_to_Octal(){int n,r[10],i;coutn;cout
Binary is a base 2 number system, while octal is base 8. This happens to make conversion between binary and octal fairly trivial, although more complex than conversion to hexadecimal. To convert to octal from binary, take each three bits, starting from the least significant bit, and convert them to their octal equivalent. Examples: 25510 = 111111112 = 11 111 111 = 3778 17410 = 101011102 = 10 101 110 = 2568 You can repeat this process for as many bits as you need. A 24-bit number should translate into 8 octal numbers, for reference.
Octal: 56704534 Decimal: 12290396
(83)base10 to octal
A45C: Decimal = 42076 Octal = 122134
BB895C: Octal = 56704534 Decimal = 12290396
221122: Binary = 1000100001000100100010 Octal = 10410442 Decimal = 2232610
NA
Octal = 56704534 Decimal = 12290396
In binary this number is equivalent to 11111000011 while in octal it is 3703
That can't be an octal number; it has an 8 in it.
71
166 in decimal
262 octal is178 decimal.262 decimal is406 octal