It's easy to convert binary to octal. Each 3 bit group of a binary number convert to an octal value. We work right to left.
1 101 001 111 011 = 15173
printf ("%d is %o in octal\n", x, x);
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.
The best way is to first convert hexadecimal to binary and then to octal. For example the hexadcimal number B4EA is in binary: B 4 E A 1011 0100 1110 1010 Thus B4EA (hexadecimal) = 1011010011101010 (binary) We add leading zeros to the binary number in order to be able to divide the number in sets of 3 digits. Then we convert easy to octal as follows: 001 011 010 011 101 010 1 3 2 3 5 2 Therefore 1011010011101010 (binary) = 132352 (octal) and from here you have your result: B4EA (hexadecimal) = 132352 (octal)
Assuming the binary number is given as a string and the octal number must be, too:Initalise a result value to zero.For each digit in the binary number, from right to left:If the digit is a '1':Add (1
Octal and hexadecimal numbers are used extensively by computer specialists because octal and hexadecimal are easily converted to and from binary. You simply group the binary bits into groups of 3 or 4 and then convert that group into octal or hexadecimal, or you convert the octal or hexadecimal digit into a group of 3 or 4 binary bits. With practice, you can do this at sight.
15173
Octal = 52746757 Binary = 101010111100110111101111
Don't. 889 is not an octal number.
Starting from the right, partition into triplets. Then convert each triplet of binaries into octal as follows: 000 = 0 001 = 1 010 = 2 011 = 3 100 = 4 101 = 5 110 = 6 111 = 7 That's it!
fdfd
134.105
In binary this number is equivalent to 11111000011 while in octal it is 3703
221122: Binary = 1000100001000100100010 Octal = 10410442 Decimal = 2232610
ABC hex is 43968 decimal so octal is: 125700 binary is: 1010101111000000
printf ("%d is %o in octal\n", x, x);
128 is not a valid octal number. Please restate the question.
1470 octal = 001 100 111 000 binary