The 0-1 of Binary Code

 What is Binary Code?

A Binary Code represents numbers, text, or any other data using a systems of 0s and 1s. It is the only type of code that a computer can understand. When we write a code in any language like Python, Java, HTML, C, C++, QBasic etc, the code goes to the CPU or microchip in case of Laptops and is converted into binary by a compiler or interpreter.

The computer or Laptop then reads it and executes the code.

How to turn decimals into binary?

There is a simple algorithm for turning decimal numbers into binary numbers.

For eg. we have the number 23

We divide it by 2

23/2=11

We write the remainder in the side                                                                        1

11/2=5                                                                                                                    1

5/2=2                                                                                                                      1

2/2=1                                                                                                                      0

1/2=0                                                                                                                      1

Now, writing the remainders in the backward sequence, we get the binary code for the number (here, 23)

Binary for 23 -> 10111

How to turn binary into decimals?

There is another algorithm for turning binary code into decimals.

For eg. we have the binary code 11110011

Here, we have to multiply the numbers starting from the right by 2n .

1*20=1

1*21=2

0*22=0

0*23=0

1*24=16

1*25=32

1*26=64

1*27=128

The decimal number will be

1+2+0+0+16+32+64+128

=243

The decimal number is 243.

That is all for today's post. Hope this post was informative. Please contact me through the comments section or by filling the contact form.

Regards,

Aarav Iyer

References:

(1) https://en.wikipedia.org/wiki/Binary_code

(2) https://www.indeed.com/career-advice/career-development/how-to-write-in-binary

Aarav Iyer

I am a technology and programming enthusiast, currently a high school student. I also love drawing and am fairly interested in aeronautics and astrophysics. My favourite pastimes are reading books, blogging and skywatching with my telescope.

Post a Comment

Previous Post Next Post