Have you heard the question : What is the value of 2 hundreds 1 tens and 3 ones?
213 right?? You all learned that in elementary school..
You did ( 2 * 100 ) + ( 1 * 10 ) + ( 3 * 1 )
But why?? Let me tell you a short story to explain..
There was a girl, who wanted to count many Candies.. So she started from 0 (no candies) to 1, to 2, to 3.. and she reached 9..
She found he doesn't have any more numbers to count on..
So what she did??
She kept one (1) aside, which will tell her that 10 candies are counted and stared counting from 0 again.
So she went from 9 to 1,0 (ten).. Then again 1,1 to 1,2 and so on..
She again reached 1,9 (nineteen).
She was happy at her decision because she can just increment that 1 she kept aside and can go from 1,9 to 2,0 (twenty).
She continued counting 2,0 then 2,1... and reached 9,9 (ninety nine) and again she got stuck.
So what she did? She again followed her approach and kept 1 aside to represent 100 (hundred).. and did 1,0,0 (one hundred) then again 1,0,1 and she continues..
And in the end she counted 2 hundreds 1 tens and 3 ones which turned out to be 213 (Two Hundred and Thirteen).
Makes sense??
Hope so!
So, now a computer wants to count the candies..
But bechara computer... only understands ON (0) or OFF (1). So these are the only two numbers it can count on.
So it started counting and followed the little girls technique.
It counted 0 (zero) and 1 (one).
Now what..?
It took one (1) and kept it aside to represent 2.
It counted again 1,0 (One Zero) and 1.1 (One One)
Again it stuck..
So it again kept one (1) at third position to represent four (4) and counted 1,0,0 (One Zero Zero), 1,0,1 (One Zero One) and so on....
The number system which the girl used is known as Decimal Number System or Base 10 System.
And The number system which the computer uses is known as Binary Number System or Base 2 System.
The base of the system is defined as the number of digits which are available to do the counting.
In base 10 there are 10 digits to count namely 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
And Similarly in base 2 there are 2 digits : 0 and 1
But why do we need the base of a number system?
We need the base to convert between different number systems and get the actual value of our counting.
Eg: 314 is represented ( 3 x 100 ) + ( 1 x 10 ) + ( 4 x 1 )
which can also be represented as ( 3 x (10)^2 ) + ( 1 x (10)^1 ) + ( 4 x (10)^0 )
where a^b : a to the power b
The value of a number at a particular place is calculated as ( <The digit> x ( <the base> ^ <place> ) ).
Eg 2: value of 1010 of decimal number system.
It can be calculated similarly as above as
( 1 x (2)^3 ) + ( 0 x (2)^2 ) + ( 1 x (2)^1 ) + ( 0 x (2)^0 )
Why? Because 2 is the base value of Decimal Number System.
So, the value of 1010 becomes 8 + 0 + 2 + 1 = 12
And similarly it can be written as 1 eights, 0 fours, 1 twos and 0 ones.
I hope I made some sense... :P
Make sure to comment below and let me know..
No comments:
Post a Comment