# Binary code: how does computer language work?

Every day, we talk here at TecMundo computers, data processing and memories. But, has anyone ever stopped to think that all this information is stored in a sequence of codes? The problem is that the computer, being an electronic machine, only “understands” two pieces of information: presence or absence of power, on or off.

In this way, we can only work mathematically with two digits, 1 and 0, to write all other numerical values ​​and, because they are only two digits, we call the binary system. By analogy, when we use the decimal system, we use the Arabic numerals 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.

## How to convert a decimal number to binary form?

The easiest way to convert a decimal number to binary is to divide it by two. Do the division manually, and write down the rest (as you are dividing by 2, the rest will always be 1 or 0). Take the quotient of that division and continue dividing by two, until the quotient is 1 (2 divided by 2). See example below:

Source: Uol Education / ReproductionSource: Education Uol

The number, in this case 25, in binary will be 1 + all the remainder of the divisions, from the smallest to the largest quotient, that is, for the computer what we write with the figures 25 is the binary 11001.

## How to convert a binary number to the decimal system?

To transform a binary number into a decimal, take each digit of its number separately and convert it into a series of powers of the number 2 (base of the binary system), raising each one to progressive exponents, starting from 0 on the right. Then, multiply the result by the original number. In the case of binary 111010, for example, we have:

### 111010

0. 20 = 0

1 . two1 = 2

0. twotwo = 0

1 . two3 = 8

1 . two4 = 16

1 . two5 = 32. Adding all the products together, we have the decimal number: 58. See:

UFABC

Source: UFABC / Reproduction

See below for a list with the numbers from 0 to 20, written in decimal and binary form.

Source: MecaWeb / ReproductionSource: MecaWeb

## Not just numbers

All of this data is stored on the computer as a sequence of codes. Not just the numbers, but also the letters. There is an associated number for each letter. For example, the letter “A” usually corresponds to the number 65. The number “1” within a text corresponds to the number 49.

If we were to write TecMundo in binary language, it would look like this: 01010100 01100101 01100011 01001101 01110101 01101110 01100100 01101111. This means that although all data is always stored with 0’s and 1’s, the reading we make of them is that they will define their informational value.

Within this logic, binary 65 can be read as well as the number 65 or the capital letter A, depending on how the computer will be programmed. But program instructions also use binary codes. A set of these instructions, with a specific purpose, is what we call “software”, or “program”.

Source: iStock / ReproductionSource: iStock

## Chatting with computers

Fortunately, modern computers are very easy to operate, and all these conversions are done automatically, and we don’t even see them. But you can be sure that, while typing here and reading there, the sequence on off off off on continues, always in the form 0 1 0 1 001101010101010.

Just like the Portuguese language, which we use to communicate, binary coding also has syntax and semantics characteristic that allow humans and computers to “talk”. It is the programming language, an interface that makes it easier for humans to access and control tasks performed by electronic circuits.

The professional responsible for writing code through programming languages ​​is the programmer, also called the developer, our dear Devs, who manage to make the computer understand the message we wanted to pass on to you.