Binary Numbers in C++

Binary Numbers: The Best format for computer to understand, write, code, and decode. These numbers have just Base 2.

DT
14 Jan, 2020 • 1 min read • en
❤️ 0 💬 0 👁 1716
Binary Numbers in C++

Why Binary Number has Base 2?

 

Binary Numbers has Base “2” that means it consists of two numbers “0” and “1”. Binary Language is a language in which a computer communicates between themselves. The various functioning taking place inside a computer is on hardware level.

So, we cannot store the files inside a Computer Memory or it cannot be created. So, the numbers are stored in form of Cells

For Example:

If any particular cells have “+V” charge then, 1 is being stored.

If any particular cells have “+0” charge then, 0 is being stored.

In a Binary format numbers are stored in a form of 0 and 1.

The operators which work on Binary Numbers are as follows:

1.      And

2.      Or

3.      Exclusive Or

4.      Not

5.      Left Shift

6.      Right Shift

The above-mentioned operator works at Bit Level.

Converting a Binary Number into Decimal Number

 

Binary Number: 1111

12^3 + 12^2 + 12^1 + 12^0

Each of the number present at bits level is multiplied with a power of 2 increasing each time

Decimal Number: 15

 

Converting a Decimal Number into Binary Number

 

Decimal Number: 5

5 % 2 = 1 ; 5 / 2 = 2

2 % 2 =0 ;  2 / 2 =1

1 % 2 = 1 ; 1/ 2 = 0

Each time a the quotient is modulus by 2 and the remainder is then taken in reverse order when final digit is 0.

0 likes
☕

Support DT

Appreciate this story? Send a small tip to encourage the author to write more great work!

Please login to tip the author.

DT
Published By

DT

@DT

Comments

Appreciate the author by telling what you feel about the post 💓

Please Login or Create a free account to comment.

★ Recommended For You

Stories tailored to your recent reading preferences

More stories in Education
offbeatpixels • 19 Oct, 2026 • 1 min read

GTM Strategy

GTM stands for Go-to-Market. It is the plan a business prepares before entering a new market, expanding into a new geography or launching a product or service.

16 0
More stories in Education
Xleem • 01 Jul, 2026 • 1 min read

Life

Life is a long journey, and most of us spend it chasing what we lack, while forgetting to be grateful for what we already hold.

122 0
More stories in Education
Xleem • 01 Jul, 2026 • 1 min read

Li3f

Just read it

112 1
More stories in Education
Adhiraj • 14 Oct, 2025 • 2 mins read

अंतर्राष्ट्रीय स्कूल

कहानी का संदर्भ शिक्षा के बढ़ते व्यापारिक स्वरूप से है | किस प्रकार शिक्षा दान के स्थान पर व्यापार बन कर विद्यालयों की गुणवत्ता गिरती जा रही है, इस समस्या का जिक्र कहानी में व्यंगात्मक रूप में प्रस्तुत किया गया है |

277 1