0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【基本情報技術者】2進数を8進数に変換

Last updated at Posted at 2021-02-06

2進数1010.01を8進数に変換

【解説】
まず2進数1010.01を3桁ごとに区切ります.
ここでは計算しやすいように、小数点で区切り、
計3桁になるように0を付け加えます。

今回であれば001-010-.010 という感じです.

8進数は2の3条なので
3桁目は値×4
2桁目は値×2
1桁目は値×1
となり、
それぞれ出た数値を文字列的に並べれば8進数へと変換できます。

今回の場合だと

001
0 * 4 = 0
0 * 2 = 0
1 * 1 = 1
= 1

010
0 * 4 = 0
1 * 2 = 2
0 * 1 = 0
= 2

.010
0 * 4 = 0
1 * 2 = 2
0 * 1 = 0
= .2

これを並べると 12.2となり、この数値が8進数に変換した1010.01となります。

*補足
8進数は01234567の8桁で表します

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?