80 likes | 207 Views
Learn about weight of digits, conversions, binary addition, and number of possibilities in different bases like decimal, binary, hexadecimal, and octal. Understand how to manipulate numbers and perform basic arithmetic in various number systems.
E N D
Lesson 2 0x002010 Coding Part 2
Weight of the Digit • Weights • Decimal Example (3672)10 • Binary Example (1011)2
Number of Possibilities • Binary (base= 2) 2 4 8 16 Number of possibilities = (B)n B : Base n : # of Digits
Number of Possibilities • Decimal (Base =10) 10 1000 100 Number of possibilities = (B)n B : Base n : # of Digits
Number of Possibilities Hexadecimal (Base =16) • Octal(Base =8) Number of possibilities = (B)n Number of possibilities = (B)n 1 Digit Number of possibilities = (8)1 =8 1 Digit Number of possibilities = (16)1 =16 2 Digits Number of possibilities = (8)2 =64 2 Digits Number of possibilities = (16)2 =256 5 Digits Number of possibilities = (8)5 = 32768 5 Digits Number of possibilities = (16)5 = 11029518992652895256576
Conversion Table • Binary Base =2 = (2)1 • Octal Base = 8= (2)3 • Hexadecimal Base =16 = (2)4 • Their base have number 2 as a common • That’s why • 1 Octal digit equivalent to 3 Binary • 1 Hex digit equivalent to 4 Binary digits * Look at the table and notice binary columns
Binary Addition • 0 + 0 = 0 • 0 + 1 = 1 • 1 + 0 = 1 • 1 + 1 =10 * Look at the table and notice binary columns
Binary Addition 1 5 1 3 + ----- 28 • How do we do Decimal Addition ? =5+5 =10-B =0 =5+7 =12 –B =2 1 1 1 5 1 5 + ----- 30 1 5 1 7 + ----- 32 Case 1: the result is less than Base Case 2: the result equals Base Case 3: the result is higher than Base • Do it for Binary 01 01+ ----- 10 01 01 01+ ----- 11 00 01+ ----- 01