Книга: Advanced PIC Microcontroller Projects in C

1.12 Converting Octal Numbers into Decimal

1.12 Converting Octal Numbers into Decimal

To convert an octal number into decimal, calculate the sum of the powers of 8 of the number.

Example 1.15

Convert octal number 158 into decimal.

Solution 1.15

Calculating the sum of the powers of 8 of the number:

158 = 1 ? 81 + 5 ? 80

     = 8 + 5

     = 13

The decimal number is 1310.

Example 1.16

Convert octal number 2378 into decimal.

Solution 1.16

Calculating the sum of the powers of 8 of the number:

2378 = 2 ? 82 + 3 ? 81 + 7 ? 80

     = 128 + 24 + 7

     = 159

The decimal number is 15910.

Оглавление книги


Генерация: 1.081. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз