We are using languages for communication.Here we are going to communicate with machines through Programming Languages.As, we have seen earlier there are many programming languages.But there is some basics you have to learn about these.First thing is,
- Binary Digits We all know that computer know only binary.But how it has managed to live with Two Digits
- Number 5 divided by 2 and then quotient is 2 remainder is 1 and this is our first binary digit.
- Then quotient '2' divided by 2 quotient is 1 and remainder is 0 our second binary.
- next what about the quotient now because if we divide 1 then the remainder will be 1.so obviously our last binary digit for 5 is 1
In english language we have only 26 letters.we are using the 26 letters repeatedly to create the words.Like that computer also using the digits repeatedly.
Okay, Let's get into the concept.
Computer memory needs to be measured .Thus only we can know how much memory we are using.Memory size calculated by bits and bytes.If we want to store binary digit '1' into memory we need 1 bit of memory.So the one binary digit is 1 bit.
1 Binary Digit | = | 1 Bit |
8 Bit | = | 1 Byte |
1024 Bytes | = | 1 KB |
1024 KB | = | 1MB |
We just can't store 5 binary 1 for Number '5'.If we do like that that will use lot of memory and the binary digit 0 is going to be useless.We have to reduce the memory usage.Thus only the machine could work faster.Machines will convert '5' to binary digits.You know what is the binary version of '5'?
It's 101
Like this every number has a binary value. Number 8 is 1000.It's Okay .How we did that?It has involved simple mathematics L.C.M.
2|___5
2|___2 --> 1
2|___1 --> 0
Binary value: 101
can you understand? what is going here?I'll explain that.2|___2 --> 1
2|___1 --> 0
Binary value: 101
Another Example:
Number 8
2|___8
2|___4 --> 0
2|___2 --> 0
2|___1 --> 0
Binary digit for 8 is 1000
This is how integer converted into binary. Now I want you to try any number you want with your notebook.You can check your answer here:2|___8
2|___4 --> 0
2|___2 --> 0
2|___1 --> 0
Binary digit for 8 is 1000