cpit 201 week 2 lecture 1week 2 lecture 1 faculty of computing and information technology.rabegh...
TRANSCRIPT
C 20CPIT 201Week 2
Lecture 1
FACULTY OF COMPUTING AND INFORMATION TECHNOLOGY.RABEGH
Converting from one number system to another
A b i b bAny number in one number system can be represented in any other system
Converting to decimal number system from another base.
The following three steps are used to convert to a base-10value from any other number system.y y
1.Determine the place value of each digit. The positional value depends on the position of the digit and the base of the number system.2.Multiply the obtained positional values by digit in the corresponding position.
3.Sum of the products calculated in step 2 , the total is the equivalent value in decimal.
Determine the decimal equivalent of the following numbers. Example 1.(1101101)2=(10)10
Place value 26 25 24 23 22 21 20
Number: 1 1 0 1 1 0 1
N 26 * 1 25N=26 * 1+25 *1+24*0+23*1+22*1+21*0+20*164+32+0+8+4+0+1=64+32+0+8+4+0+1 =(109)10
The Division Method. Divide by 2 until you reach zero, d h ll h i d iand then collect the remainders in reverse.
Decimal to Binary(35)10 = (?)210 2
2( 35 Reminder---------
2(17 1 LSB2(17 1 LSB---------
2( 8 1---------
2( 02( 4 0---------
2( 2 0---------
2( 1 0---------0 1 MSB
(35) (100011)(35)10 = (100011)2
Eg.2): (101.11)2= (?)10Place value : 22 21 20 . 2-1 2-2
Number : 1 0 1 . 1 1N (22*1) + (21*0) + (20*1) + (2 1*1)+(2N= (22*1) + (21*0) + (20*1) + (2-1*1)+(2-
2*1)
=4+0+1+1/2+1/4
(5 75)=(5.75)10
Eg: 3 (1256)8=(??)10 Place value :83 82 81 80
Number : 1 2 5 63 2 0N=83*1+82*2+81*5+80*6
=512+128+40+6(686)=(686)10
Eg.2 (23.17)8=(?)10
Place Value:81 80 . 8-1 8-2
Number : 2 3 1 7Number : 2 3 1 7 N=2*81 + 3*80 + 1/8 +7/64N=16+3+0 125+0 109N=16+3+0.125+0.109N=(19.234)10
The Division Method. Divide by 8 until you reach zero, and then collect the remainders in reverse.
433010 = 1035288 ) 43308 ) 4330 8 ) 541 28 ) 67 58 ) 67 5 8 ) 8 3 8 ) 1 08 ) 1 0
0 1
(2AE)16=(?)10
Place Value :162 161 160
Number : 2 A ENumber : 2 A E
N : 162*2+ 161*10+ 160*14=256*2+16*10+1*14=512+160+14=(686)10
The Division Method. Divide by 16 until you reach zero and then collect the remainders in reversezero, and then collect the remainders in reverse.
12610 = 7E1612610 7E1616) 126 Rem:
16) 7 14=E )0 7