teach-ict.com logo

THE education site for computer science and ICT

3. Uses of binary: Integers

Binary numbers are what computers use to represent any kind of data whether that data is music, text, numbers or video.

Integers

Integers are whole numbers without a decimal point such as 255 or 717161617817. An integer is represented in a computer as a binary number. For example the number 1 is represented as

                              00000001

An 8 bit binary number can represent integers 0 to 255. For example 255 as a binary number is:

                              11111111

As you can see, every bit is set to 1 which means it can't be any bigger. And so 255 is the largest number an 8 bit number can represent. If a larger number needs to be handled, then more bits need to be used. For example a 16 bit binary number can handle integers up to 65,535

                         1111 1111 1111 1111

You can work out the largest number a given amount of bits can represent by using a calculator to raise 2 to the power of the number of bits. For example the largest integer a 10 bit binary number can represent is:

$$2^{10} = 1024 $$

Integers can also be negative such as -23 but your syllabus does not need you to cover negative numbers.

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Representing integers in binary