Download presentation
Presentation is loading. Please wait.
1
Lecturer: Santokh Singh
CompSci 105 SS 2005 Principles of Computer Science Lecture 2 Lecturer: Santokh Singh
2
Numbers in the Computer
Binary representation of integers Octal representation of integers Hexadecimal representation of integers Binary Arithmetic Addition Subtraction Using Bits as Bits Logical Operations
3
Positive Integers In the range 0-3 …. 11 00 01 10
4
Decimal Numbers 2 1 7 3
5
Decimal Numbers 1000 100 10 1 2 1 7 3
6
Decimal Numbers 103 102 101 100 2 1 7 3
7
Binary Numbers 1 1 1
8
Binary Numbers 23 22 21 20 1 1 1
9
Binary Numbers 8 4 2 1 1 1 1
10
Exercise Convert the binary number to decimal
11
Converting to Binary 1011 11 ? 1011 11
12
Digit Manipulation Removing the last digit of a number Extracting the last digit of a number 2173 217 ? 2173 3 ?
13
Extract in Right to Left Order
2173
14
Converting to Binary Repeat until number is empty
Extract last binary digit Remove last binary digit
15
Exercise Convert the decimal number 77 to binary
16
Numbers in the Computer
Binary representation of integers Octal representation of integers Hexadecimal representation of integers Binary Arithmetic Addition Subtraction Using Bits as Bits Logical Operations
17
1 5 + 6 1 2 + 3 8 7 + 15 1 + 2 6 4 + 10 2 3 + 5 9 + 18 3 7 + 10 1 +
18
1 1 + + 1 + + 1 1 1 10
19
1 1 1 + 1 1 1
20
1 1 1 - 1 1
21
Exercises Perform the following binary calculations. Convert to base 10 to check your answer: 101110 101110
22
If binary is so much easier, why do we use base 10 for most things?
23
If binary is so much easier, why do we use base 10 for most things?
275
24
Numbers in the Computer
Binary representation of integers Octal representation of integers Hexadecimal representation of integers Binary Arithmetic Addition Subtraction Using Bits as Bits Logical Operations
25
Octal 1 2 3 000 001 010 011 4 5 6 7 100 101 110 111
28
Hexadecimal 0001 1 0010 2 0000 0011 3 0101 5 0110 6 0100 4 0111 7 1001 9 1010 A 1000 8 1011 B 1101 D 1110 E 1100 C 1111 F
29
Hex Numbers and Bytes 1000 1011 0010 0011
30
Course Book Notes for 1st and 2nd lecture:-
Pages : Numbers in the Computer Pages : Data Representations
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.