SlideShare a Scribd company logo
1 of 23
Download to read offline
Saeed Ullah Jan
(PhD – Scholar University of Malakand)
Lecturer in Computer Science
Govt Degree College Wari (Dir Upper)
Email: saeedullah@uom.edu.pk // saeedjan03@gmail.com
Phone: 0944-840488
Course Title: Digital Logic & Computer Design
Program: BS – Computer Science 3rd Semester
Number System
 Number System
Symbols using for counting numerical quantities or measure
 Common Number System
1) Binary (0,1) also called base 2 like (1001101) 2
2) Octal (0,1,2,3,4,5,6,7) base 8 like (5446) 8
3) Decimal (0,1,2,3,4,5,6,7,8,9) base 10 like (742869) 10
4) Hexadecimal (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) base 16 like (18AF9)16
 Conversion
Before going to this section, the tables in next slide must be
remember to everyone
0 0 = 0
0 1 = 1
1 0 = 2
1 1 = 3
• For two Binary Numbers, all the
possible combinations are as under
n=2 and 2n = 22 = 4
• For Three Binary Numbers, all the
possible combinations are as under
n=3 and 2n = 23 = 8
0 0 0 = 0
0 0 1 = 1
0 1 0 = 2
0 1 1 = 3
1 0 0 = 4
1 0 1 = 5
1 1 0 = 6
1 1 1 = 7
• For Four Binary Numbers, all the
possible combinations are as under
n=4 and 2n = 24 = 16
0 0 0 0 = 0
0 0 0 1 = 1
0 0 1 0 = 2
0 0 1 1 = 3
0 1 0 0 = 4
0 1 0 1 = 5
0 1 1 0 = 6
0 1 1 1 = 7
1 0 0 0 = 8
1 0 0 1 = 9
1 0 1 0 = A
1 0 1 1 = B
1 1 0 0 = C
1 1 0 1 = D
1 1 1 0 = E
1 1 1 1 = F
Binary to Octal
1-Group the Binary Numbers from
right to left in 3 bits length.
2- Find the equivalent binary
number from the table
3- Write the replaced number
together
0 = 0 0 0
1 = 0 0 1
2 = 0 1 0
3 = 0 1 1
4 = 1 0 0
5 = 1 0 1
6= 1 1 0
7= 1 1 1
Binary to Decimal
1) Multiply each binary number with 2
2) Each binary multiplication number with 2 will add with the next binary number
multiplication with 2
3) Assign power on two from right to left
4) Follow ordinary mathematical method and at the end add all the digits
Example:
(110011)2=()10?
(110011)2= 1x25+1x24+0x23+0x22+1x21+1x20
(110011)2=32+16+0+0+2+1
(110011)2=(51)10
(101101)2=()10?
= 1x25+0x24+1x23+1x22+0x21+1x20
=1x32+0x16+1x8+1x4+0x2+1x1
= 32+0+8+4+0+1
= (45)10
Binary to Hexadecimal
1-Group the Binary Numbers from right to left in 4 bits length.
2- Find the equivalent binary number from the table
3- Write the replaced number together
0 0 0 0 = 0
0 0 0 1 = 1
0 0 1 0 = 2
0 0 1 1 = 3
0 1 0 0 = 4
0 1 0 1 = 5
0 1 1 0 = 6
0 1 1 1 = 7
1 0 0 0 = 8
1 0 0 1 = 9
1 0 1 0 = A
1 0 1 1 = B
1 1 0 0 = C
1 1 0 1 = D
1 1 1 0 = E
1 1 1 1 = F
Octal to Binary
step 1: Separate the digits of the given octal number,
if it contains more than 1 digit.
step 2: Find the equivalent binary number for each
digit of octal number. Add 0's to the left if any of the
binary equivalent is shorter than 3 bits.
step 3: Write the all group's binary numbers
together, maintaining the same group order provides
the equivalent binary for the given octal number.
For Example: Convert the octal 76318 to its binary
equivalent.
0 0 0 = 0
0 0 1 = 1
0 1 0 = 2
0 1 1 = 3
1 0 0 = 4
1 0 1 = 5
1 1 0 = 6
1 1 1 = 7
Octal to Decimal
Step 1:Take the given octal number.
Step 2: Find out the number of digits in the number
Step 3: Let it have n digits.
Step 4: Multiply each digit in the number with 8n-1,when the digit is in the
nth position.
Step 5: Add all digits after multiplication.
Step 6: The resultant is the equivalent decimal to the given octal number.
If octal number contains a decimal point
Step 7: Let m digits are there after the decimal
Step 8: Multiply each digit after decimal with ,when the digit is the nth
position.
All other steps are same as above.
Question 1: Convert 57468 to decimal number
Solution:
The given number is 57468
57468 = (5 x 83)+ (7 x 82) + (4 x 81) + (6 x 80)
=5 x 512 + 7 x 64 + 4 x 8 + 6 x 1
= 2560+448+32+6
= 3046
The equivalent decimal number for 57468 is 3046
57468 = 3046
Octal to Hexadecimal
Step 1: Let the number of digits in the number be n
Step 2: Multiply the digits with 8n-1where n is position of digit from the right
end of the number. If the number has decimal part the multiply digits after
decimal by where m is position of the number from the decimal
Step 3: Add the terms after multiplication
Step 4: The obtained number is equivalent decimal number to the given octal
Step 5: Consider the decimal number, divide it by 16
Step 6: Note the remainder.
Step 7: Continue the process till the quotient in zero
Step 8: Write the remainder in the reverse order
Step 9: The obtained number is equivalent hexadecimal number
to the given octadecimal number.
Example:
(715)8=()16?
(715)8=(111,0001,0101)2
(715)8=(0001,1100,1101)2
So
(715)8=(1CD)16
0 0 0 0 0
0 0 0 1 1
0 0 1 0 2
0 0 1 1 3
0 1 0 0 4
0 1 0 1 5
0 1 1 0 6
0 1 1 1 7
1 0 0 0 8
1 0 0 1 9
1 0 1 0 A
1 0 1 1 B
1 1 0 0 C
1 1 0 1 D
1 1 1 0 E
1 1 1 1 F
Decimal to Binary
To convert integer to binary, start
with the integer in question and
divide it by 2 keeping notice of
the quotient and the remainder.
Continue dividing the quotient by
2 until you get a quotient of zero.
Then just write out the
remainders in the reverse order.
For Example
(156)10 = (?)2
= (10011100)2
Decimal to Octal
Step 1: Take the given decimal number
Step 2: If the number is less than 8 the octal number is the same
Step 3: If the number is greater than 7 then Divide the number with 8
Step 4: Note the remainder
Step 5: Carry on the step 3 and 4 with the quotient till it is less than 8
Step 6: Write the remainders in reverse order(bottom to top)
Step 7: The resultant is the equivalent octal number to the given
decimal number Examples:
Decimal to Hexadecimal
 Divide the decimal number by 16. Treat the division
as an integer division.
 Write down the remainder (in hexadecimal).
 Divide the result again by 16. Treat the division as an
integer division.
 Repeat step 2 and 3 until result is 0.
 The hex value is the digit sequence of the remainders
from the last to first.
DIVISION RESULT
REMAIN
DER (in
HEX)
256 / 16 16 0
16 / 16 1 0
1 / 16 0 1
ANSWER 100
Example 1
Convert the number 256 DECIMAL to HEXADECIMAL
DIVISION RESULT
REMAINDER
(in HEX)
921 / 16 57 9
57 / 16 3 9
3 / 16 0 3
ANSWER 399
Example 2
Convert the number 921 DECIMAL to HEXADECIMAL
DIVISION RESULT
REMAINDER
(HEX)
100 / 16 6 4
6 / 16 0 6
ANSWER 64
Example 3
Convert the number 100 DECIMAL to HEXADECIMAL
DIVISION RESULT
REMAINDER
(HEX)
590 / 16 36 E (14 decimal)
36 / 16 2 4 (4 decimal)
2 / 16 0 2 (2 decimal)
ANSWER 24E
Example 4
Convert the number 590 DECIMAL to HEXADECIMAL
Hexadecimal to Binary
Use the table and convert hexadecimal to
binary easily.
Example:
(1AD)16=(?)2
 The binary value for 1 in the table is 0001
 The binary value for A in the table is 1010
 The binary value for D in the table is 1101
 Now, from this we can easily solve, the given
example
(000110101101) is the equivalent of (1AD)16 or
Simply 110101101)2 = (1AD)16
0 0 0 0 = 0
0 0 0 1 = 1
0 0 1 0 = 2
0 0 1 1 = 3
0 1 0 0 = 4
0 1 0 1 = 5
0 1 1 0 = 6
0 1 1 1 = 7
1 0 0 0 = 8
1 0 0 1 = 9
1 0 1 0 = A
1 0 1 1 = B
1 1 0 0 = C
1 1 0 1 = D
1 1 1 0 = E
1 1 1 1 = F
Hexadecimal to OctalStep 1: Consider the given hexadecimal number
Step 2: First count the number of digits in the number
Step 3: If n is the position of the digit from the right end then multiply each digit with 16n-1
Step 4: Add the terms after multiplication
Step 5: Resultant is the equivalent decimal form
Step 6: Divide the decimal number with 8
Step 7: Note down the remainder
Step 8:Continue step 6 and 7 with the quotient, until the quotient is zero
Step 9: Write the remainders in reverse order
Step 10: The obtained number is the required result.
Hexadecimal to Decimal
 To convert a hexadecimal to a decimal manually, you must start by multiplying the hex number by
16. Then, you raise it to a power of 0 and increase that power by 1 each time according to the
hexadecimal number equivalent.
 We start from the right of the hexadecimal number and go to the left when applying the powers.
Each time you multiply a number by 16, the power of 16 increases.
For Example
(2A9)16 = (?)10
= 2x162 + A(10)x161 + 9x160
= 2x256 + 10x16 + 9x1
= 512 + 160 + 9
= 681
Therefore, (2A9)16 = (681)10
Another Example
(5F3C)16 = (?)10
= 5x163 + F(15)x162 + 3x161 + C(13)x160
= 5x4096 + 15x256 + 3x16 + 13x1
= 2096 + 3840 + 48 + 13
= 5997
Therefore, (2A9)16 = (5997)10
Binary Arithmetic
The arithmetic of binary numbers means the operation of addition, subtraction,
multiplication and division. Binary arithmetic operation starts from the least significant
bit i.e. from the right most side. We will discuss the different operations one by one in the
following article.
1) Binary Addition
There are four steps in binary addition, they are written below:
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 0 (carry 1 to the next significant bit)
Example
2) Binary Subtraction
Here are too four simple steps to keep in memory 0 - 0 = 0
0 - 1 = 1, borrow 1 from the next more significant bit
1 - 0 = 1
1 - 1 = 0
A binary arithmetic example is given to understand the operation more clearly
Suppose, A = 10101100 and B = 1010100 and we want to find out A - B. Now implementing
the rules of binary subtraction
Here 0 - 1 = 1 with borrowing of 1 from the next significant
bit and that’s what has been done. We will treat the next 1
as 0 in the next step as shown below.
Again the last 1 has been borrowed because the operation
done was 0 - 1 = 1 with borrow 1 from the next most
significant bit and the final result of binary subtraction,
we got is written in the place of result in the final step.
3) Binary Multiplication
binary multiplication there are also four steps to be followed during a bigger
multiplication or we can say these fundamental steps as well.
Example
10101101x1101 = 10101101
1101
____________________________
10101101
00000000x
10101101xx
10101101xxx
_______________________________
Now, using simple addition method, x means nothing blank or consider it zero
=100010001011
4) Binary Division
Though it is not too much difficult, it may look a bit tougher than the other binary
operations because all the other had some similarity among themselves like they all had
four basic steps which made all the processes quiet easy to understand but the binary
division process does not have any specific rule to follow. Though this process is quite
similar to the decimal division. The process will not be clear until we look at an example.
Let us take A = 11010 and B = 101
In this step 101 is subtracted from 110. This step is also
very easy to understand as we already know binary
subtraction method. Now going into the next step.
As of the rules of division the next least significant bit comes down and
we try to multiply 1 with divider i.e. B but the result is bigger than the
minuend so this step cannot be completed and we have to go to the
next step.
In the final step binary subtraction is
done and we get the remainder and the
operation of binary division is
completed and we get the following
result. Quotient = 101 and remainder = 1.
Binary Complementation
In binary system there are only two digits 0 and 1. In binary
system each and every number and its sign are represented
by using only these two digits 0 and 1. As the negative and
positive signs can not be written directly in binary system, we
have to find some alternative method of representing them.
1) 1’s Complement
The complement of 0 is 1 and 1 is 0, let suppose
The 1’s complement of 1101101 is 0010010
And
0001010110101000 is 1110101001010111
2) 2’s Complement
If, 1 is added with the answer of 1’s complement, then it is
said to be the 2’s complement of the said binary number, for
example the 2’s complement of 0000 0101, we have to find
the 1’s complement of 0000 0101 which is 11111010 and then
add 1 with it like
3) 9’s Complement
To obtain the 9's complement of any number we have to
subtract the number with (10n - 1) where n = number of
digits in the number, or in a simpler manner we have to
divide each digit of the given decimal number with 9. The
9’s Complement of 456 is given below:
3) 10’s Complement
Now coming to 10's complement, it is relatively easy to find out the 10's complement
after finding out the 9's complement of that number. We have to add 1 with the 9's
complement of any number to obtain the desired 10's complement of that number. Or
if we want to find out the 10's complement directly, we can do it by following the
following formula, (10n - number), where n = number of digits in the number. An
example is given below to illustrate the concept of obtaining 10’s complement. Let us
take a decimal number 456, 9's complement of this number will be:
is the 10’s complement of 456

More Related Content

What's hot (20)

Natural and Whole Numbers
Natural and Whole NumbersNatural and Whole Numbers
Natural and Whole Numbers
 
01.number systems
01.number systems01.number systems
01.number systems
 
Number system....
Number system....Number system....
Number system....
 
Basic of number system
Basic of number systemBasic of number system
Basic of number system
 
Cmp104 lec 2 number system
Cmp104 lec 2 number systemCmp104 lec 2 number system
Cmp104 lec 2 number system
 
Number Systems
Number SystemsNumber Systems
Number Systems
 
Number Systems
Number SystemsNumber Systems
Number Systems
 
Sig figs.ppt
Sig figs.pptSig figs.ppt
Sig figs.ppt
 
Number System
Number SystemNumber System
Number System
 
Introduction to digital electornics
Introduction to digital electornicsIntroduction to digital electornics
Introduction to digital electornics
 
Number systems
Number systemsNumber systems
Number systems
 
ALL ABOUT NUMBER SYSTEMS
ALL ABOUT NUMBER SYSTEMSALL ABOUT NUMBER SYSTEMS
ALL ABOUT NUMBER SYSTEMS
 
01.Number Systems
01.Number Systems01.Number Systems
01.Number Systems
 
Introducing to number system
Introducing to number systemIntroducing to number system
Introducing to number system
 
Number Systems and Binary Aritmetics
Number Systems and Binary AritmeticsNumber Systems and Binary Aritmetics
Number Systems and Binary Aritmetics
 
Number system
Number systemNumber system
Number system
 
PPT ON NUMBER SYSTEM
PPT ON NUMBER SYSTEMPPT ON NUMBER SYSTEM
PPT ON NUMBER SYSTEM
 
Binary number systems
Binary number systemsBinary number systems
Binary number systems
 
Computer number systems
Computer number systemsComputer number systems
Computer number systems
 
Number system
Number systemNumber system
Number system
 

Similar to Number system

DATA REPRESENTATION.pptx
DATA REPRESENTATION.pptxDATA REPRESENTATION.pptx
DATA REPRESENTATION.pptxMamataAnilgod
 
Number system with conversions www.eakanchha.com
Number system with conversions www.eakanchha.comNumber system with conversions www.eakanchha.com
Number system with conversions www.eakanchha.comAkanchha Agrawal
 
Number system by ammar nawab
Number system by ammar nawabNumber system by ammar nawab
Number system by ammar nawabAmmar_n
 
Chapter iii: Number System
Chapter iii: Number SystemChapter iii: Number System
Chapter iii: Number Systemkclove
 
Chapter two FHI.pptx
Chapter two FHI.pptxChapter two FHI.pptx
Chapter two FHI.pptxODAATUBE1
 
Number systems and conversions
Number systems and conversionsNumber systems and conversions
Number systems and conversionsSusantha Herath
 
numbersystem-211022083557.pdf
numbersystem-211022083557.pdfnumbersystem-211022083557.pdf
numbersystem-211022083557.pdfAsthaChaurasia4
 
Number system and their conversion
Number system and their conversionNumber system and their conversion
Number system and their conversionRam Pratap Singh
 
Binary octal
Binary octalBinary octal
Binary octaldrdipo4
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital ElectronicsJanki Shah
 
Module 1 number systems and code1
Module 1  number systems and code1Module 1  number systems and code1
Module 1 number systems and code1Deepak John
 

Similar to Number system (20)

DATA REPRESENTATION.pptx
DATA REPRESENTATION.pptxDATA REPRESENTATION.pptx
DATA REPRESENTATION.pptx
 
Number system with conversions www.eakanchha.com
Number system with conversions www.eakanchha.comNumber system with conversions www.eakanchha.com
Number system with conversions www.eakanchha.com
 
Number system by ammar nawab
Number system by ammar nawabNumber system by ammar nawab
Number system by ammar nawab
 
Chapter iii: Number System
Chapter iii: Number SystemChapter iii: Number System
Chapter iii: Number System
 
Ch 4
Ch 4Ch 4
Ch 4
 
Chapter two FHI.pptx
Chapter two FHI.pptxChapter two FHI.pptx
Chapter two FHI.pptx
 
Number Systems - AK.pptx
Number Systems - AK.pptxNumber Systems - AK.pptx
Number Systems - AK.pptx
 
DCF QNA edited
DCF QNA editedDCF QNA edited
DCF QNA edited
 
Number System.pptx
Number System.pptxNumber System.pptx
Number System.pptx
 
Number systems and conversions
Number systems and conversionsNumber systems and conversions
Number systems and conversions
 
Cit 1101 lec 02
Cit 1101 lec 02Cit 1101 lec 02
Cit 1101 lec 02
 
numbersystem-211022083557.pdf
numbersystem-211022083557.pdfnumbersystem-211022083557.pdf
numbersystem-211022083557.pdf
 
Number system and their conversion
Number system and their conversionNumber system and their conversion
Number system and their conversion
 
uyuyuy.pdf
uyuyuy.pdfuyuyuy.pdf
uyuyuy.pdf
 
Binary octal
Binary octalBinary octal
Binary octal
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital Electronics
 
Module 1 number systems and code1
Module 1  number systems and code1Module 1  number systems and code1
Module 1 number systems and code1
 
Unit 4.docx
Unit 4.docxUnit 4.docx
Unit 4.docx
 
Number system
Number systemNumber system
Number system
 
Number system
Number systemNumber system
Number system
 

Recently uploaded

EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 

Recently uploaded (20)

EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 

Number system

  • 1. Saeed Ullah Jan (PhD – Scholar University of Malakand) Lecturer in Computer Science Govt Degree College Wari (Dir Upper) Email: saeedullah@uom.edu.pk // saeedjan03@gmail.com Phone: 0944-840488 Course Title: Digital Logic & Computer Design Program: BS – Computer Science 3rd Semester
  • 2. Number System  Number System Symbols using for counting numerical quantities or measure  Common Number System 1) Binary (0,1) also called base 2 like (1001101) 2 2) Octal (0,1,2,3,4,5,6,7) base 8 like (5446) 8 3) Decimal (0,1,2,3,4,5,6,7,8,9) base 10 like (742869) 10 4) Hexadecimal (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) base 16 like (18AF9)16  Conversion Before going to this section, the tables in next slide must be remember to everyone
  • 3. 0 0 = 0 0 1 = 1 1 0 = 2 1 1 = 3 • For two Binary Numbers, all the possible combinations are as under n=2 and 2n = 22 = 4 • For Three Binary Numbers, all the possible combinations are as under n=3 and 2n = 23 = 8 0 0 0 = 0 0 0 1 = 1 0 1 0 = 2 0 1 1 = 3 1 0 0 = 4 1 0 1 = 5 1 1 0 = 6 1 1 1 = 7 • For Four Binary Numbers, all the possible combinations are as under n=4 and 2n = 24 = 16 0 0 0 0 = 0 0 0 0 1 = 1 0 0 1 0 = 2 0 0 1 1 = 3 0 1 0 0 = 4 0 1 0 1 = 5 0 1 1 0 = 6 0 1 1 1 = 7 1 0 0 0 = 8 1 0 0 1 = 9 1 0 1 0 = A 1 0 1 1 = B 1 1 0 0 = C 1 1 0 1 = D 1 1 1 0 = E 1 1 1 1 = F
  • 4. Binary to Octal 1-Group the Binary Numbers from right to left in 3 bits length. 2- Find the equivalent binary number from the table 3- Write the replaced number together 0 = 0 0 0 1 = 0 0 1 2 = 0 1 0 3 = 0 1 1 4 = 1 0 0 5 = 1 0 1 6= 1 1 0 7= 1 1 1
  • 5. Binary to Decimal 1) Multiply each binary number with 2 2) Each binary multiplication number with 2 will add with the next binary number multiplication with 2 3) Assign power on two from right to left 4) Follow ordinary mathematical method and at the end add all the digits Example: (110011)2=()10? (110011)2= 1x25+1x24+0x23+0x22+1x21+1x20 (110011)2=32+16+0+0+2+1 (110011)2=(51)10 (101101)2=()10? = 1x25+0x24+1x23+1x22+0x21+1x20 =1x32+0x16+1x8+1x4+0x2+1x1 = 32+0+8+4+0+1 = (45)10
  • 6. Binary to Hexadecimal 1-Group the Binary Numbers from right to left in 4 bits length. 2- Find the equivalent binary number from the table 3- Write the replaced number together 0 0 0 0 = 0 0 0 0 1 = 1 0 0 1 0 = 2 0 0 1 1 = 3 0 1 0 0 = 4 0 1 0 1 = 5 0 1 1 0 = 6 0 1 1 1 = 7 1 0 0 0 = 8 1 0 0 1 = 9 1 0 1 0 = A 1 0 1 1 = B 1 1 0 0 = C 1 1 0 1 = D 1 1 1 0 = E 1 1 1 1 = F
  • 7. Octal to Binary step 1: Separate the digits of the given octal number, if it contains more than 1 digit. step 2: Find the equivalent binary number for each digit of octal number. Add 0's to the left if any of the binary equivalent is shorter than 3 bits. step 3: Write the all group's binary numbers together, maintaining the same group order provides the equivalent binary for the given octal number. For Example: Convert the octal 76318 to its binary equivalent. 0 0 0 = 0 0 0 1 = 1 0 1 0 = 2 0 1 1 = 3 1 0 0 = 4 1 0 1 = 5 1 1 0 = 6 1 1 1 = 7
  • 8. Octal to Decimal Step 1:Take the given octal number. Step 2: Find out the number of digits in the number Step 3: Let it have n digits. Step 4: Multiply each digit in the number with 8n-1,when the digit is in the nth position. Step 5: Add all digits after multiplication. Step 6: The resultant is the equivalent decimal to the given octal number. If octal number contains a decimal point Step 7: Let m digits are there after the decimal Step 8: Multiply each digit after decimal with ,when the digit is the nth position. All other steps are same as above. Question 1: Convert 57468 to decimal number Solution: The given number is 57468 57468 = (5 x 83)+ (7 x 82) + (4 x 81) + (6 x 80) =5 x 512 + 7 x 64 + 4 x 8 + 6 x 1 = 2560+448+32+6 = 3046 The equivalent decimal number for 57468 is 3046 57468 = 3046
  • 9. Octal to Hexadecimal Step 1: Let the number of digits in the number be n Step 2: Multiply the digits with 8n-1where n is position of digit from the right end of the number. If the number has decimal part the multiply digits after decimal by where m is position of the number from the decimal Step 3: Add the terms after multiplication Step 4: The obtained number is equivalent decimal number to the given octal Step 5: Consider the decimal number, divide it by 16 Step 6: Note the remainder. Step 7: Continue the process till the quotient in zero Step 8: Write the remainder in the reverse order Step 9: The obtained number is equivalent hexadecimal number to the given octadecimal number. Example: (715)8=()16? (715)8=(111,0001,0101)2 (715)8=(0001,1100,1101)2 So (715)8=(1CD)16 0 0 0 0 0 0 0 0 1 1 0 0 1 0 2 0 0 1 1 3 0 1 0 0 4 0 1 0 1 5 0 1 1 0 6 0 1 1 1 7 1 0 0 0 8 1 0 0 1 9 1 0 1 0 A 1 0 1 1 B 1 1 0 0 C 1 1 0 1 D 1 1 1 0 E 1 1 1 1 F
  • 10. Decimal to Binary To convert integer to binary, start with the integer in question and divide it by 2 keeping notice of the quotient and the remainder. Continue dividing the quotient by 2 until you get a quotient of zero. Then just write out the remainders in the reverse order. For Example (156)10 = (?)2 = (10011100)2
  • 11. Decimal to Octal Step 1: Take the given decimal number Step 2: If the number is less than 8 the octal number is the same Step 3: If the number is greater than 7 then Divide the number with 8 Step 4: Note the remainder Step 5: Carry on the step 3 and 4 with the quotient till it is less than 8 Step 6: Write the remainders in reverse order(bottom to top) Step 7: The resultant is the equivalent octal number to the given decimal number Examples:
  • 12. Decimal to Hexadecimal  Divide the decimal number by 16. Treat the division as an integer division.  Write down the remainder (in hexadecimal).  Divide the result again by 16. Treat the division as an integer division.  Repeat step 2 and 3 until result is 0.  The hex value is the digit sequence of the remainders from the last to first. DIVISION RESULT REMAIN DER (in HEX) 256 / 16 16 0 16 / 16 1 0 1 / 16 0 1 ANSWER 100 Example 1 Convert the number 256 DECIMAL to HEXADECIMAL DIVISION RESULT REMAINDER (in HEX) 921 / 16 57 9 57 / 16 3 9 3 / 16 0 3 ANSWER 399 Example 2 Convert the number 921 DECIMAL to HEXADECIMAL DIVISION RESULT REMAINDER (HEX) 100 / 16 6 4 6 / 16 0 6 ANSWER 64 Example 3 Convert the number 100 DECIMAL to HEXADECIMAL DIVISION RESULT REMAINDER (HEX) 590 / 16 36 E (14 decimal) 36 / 16 2 4 (4 decimal) 2 / 16 0 2 (2 decimal) ANSWER 24E Example 4 Convert the number 590 DECIMAL to HEXADECIMAL
  • 13. Hexadecimal to Binary Use the table and convert hexadecimal to binary easily. Example: (1AD)16=(?)2  The binary value for 1 in the table is 0001  The binary value for A in the table is 1010  The binary value for D in the table is 1101  Now, from this we can easily solve, the given example (000110101101) is the equivalent of (1AD)16 or Simply 110101101)2 = (1AD)16 0 0 0 0 = 0 0 0 0 1 = 1 0 0 1 0 = 2 0 0 1 1 = 3 0 1 0 0 = 4 0 1 0 1 = 5 0 1 1 0 = 6 0 1 1 1 = 7 1 0 0 0 = 8 1 0 0 1 = 9 1 0 1 0 = A 1 0 1 1 = B 1 1 0 0 = C 1 1 0 1 = D 1 1 1 0 = E 1 1 1 1 = F
  • 14. Hexadecimal to OctalStep 1: Consider the given hexadecimal number Step 2: First count the number of digits in the number Step 3: If n is the position of the digit from the right end then multiply each digit with 16n-1 Step 4: Add the terms after multiplication Step 5: Resultant is the equivalent decimal form Step 6: Divide the decimal number with 8 Step 7: Note down the remainder Step 8:Continue step 6 and 7 with the quotient, until the quotient is zero Step 9: Write the remainders in reverse order Step 10: The obtained number is the required result.
  • 15. Hexadecimal to Decimal  To convert a hexadecimal to a decimal manually, you must start by multiplying the hex number by 16. Then, you raise it to a power of 0 and increase that power by 1 each time according to the hexadecimal number equivalent.  We start from the right of the hexadecimal number and go to the left when applying the powers. Each time you multiply a number by 16, the power of 16 increases. For Example (2A9)16 = (?)10 = 2x162 + A(10)x161 + 9x160 = 2x256 + 10x16 + 9x1 = 512 + 160 + 9 = 681 Therefore, (2A9)16 = (681)10 Another Example (5F3C)16 = (?)10 = 5x163 + F(15)x162 + 3x161 + C(13)x160 = 5x4096 + 15x256 + 3x16 + 13x1 = 2096 + 3840 + 48 + 13 = 5997 Therefore, (2A9)16 = (5997)10
  • 16. Binary Arithmetic The arithmetic of binary numbers means the operation of addition, subtraction, multiplication and division. Binary arithmetic operation starts from the least significant bit i.e. from the right most side. We will discuss the different operations one by one in the following article. 1) Binary Addition There are four steps in binary addition, they are written below: 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0 (carry 1 to the next significant bit) Example
  • 17. 2) Binary Subtraction Here are too four simple steps to keep in memory 0 - 0 = 0 0 - 1 = 1, borrow 1 from the next more significant bit 1 - 0 = 1 1 - 1 = 0 A binary arithmetic example is given to understand the operation more clearly Suppose, A = 10101100 and B = 1010100 and we want to find out A - B. Now implementing the rules of binary subtraction Here 0 - 1 = 1 with borrowing of 1 from the next significant bit and that’s what has been done. We will treat the next 1 as 0 in the next step as shown below. Again the last 1 has been borrowed because the operation done was 0 - 1 = 1 with borrow 1 from the next most significant bit and the final result of binary subtraction, we got is written in the place of result in the final step.
  • 18. 3) Binary Multiplication binary multiplication there are also four steps to be followed during a bigger multiplication or we can say these fundamental steps as well. Example 10101101x1101 = 10101101 1101 ____________________________ 10101101 00000000x 10101101xx 10101101xxx _______________________________ Now, using simple addition method, x means nothing blank or consider it zero =100010001011
  • 19. 4) Binary Division Though it is not too much difficult, it may look a bit tougher than the other binary operations because all the other had some similarity among themselves like they all had four basic steps which made all the processes quiet easy to understand but the binary division process does not have any specific rule to follow. Though this process is quite similar to the decimal division. The process will not be clear until we look at an example. Let us take A = 11010 and B = 101 In this step 101 is subtracted from 110. This step is also very easy to understand as we already know binary subtraction method. Now going into the next step. As of the rules of division the next least significant bit comes down and we try to multiply 1 with divider i.e. B but the result is bigger than the minuend so this step cannot be completed and we have to go to the next step. In the final step binary subtraction is done and we get the remainder and the operation of binary division is completed and we get the following result. Quotient = 101 and remainder = 1.
  • 20. Binary Complementation In binary system there are only two digits 0 and 1. In binary system each and every number and its sign are represented by using only these two digits 0 and 1. As the negative and positive signs can not be written directly in binary system, we have to find some alternative method of representing them. 1) 1’s Complement The complement of 0 is 1 and 1 is 0, let suppose The 1’s complement of 1101101 is 0010010 And 0001010110101000 is 1110101001010111
  • 21. 2) 2’s Complement If, 1 is added with the answer of 1’s complement, then it is said to be the 2’s complement of the said binary number, for example the 2’s complement of 0000 0101, we have to find the 1’s complement of 0000 0101 which is 11111010 and then add 1 with it like
  • 22. 3) 9’s Complement To obtain the 9's complement of any number we have to subtract the number with (10n - 1) where n = number of digits in the number, or in a simpler manner we have to divide each digit of the given decimal number with 9. The 9’s Complement of 456 is given below:
  • 23. 3) 10’s Complement Now coming to 10's complement, it is relatively easy to find out the 10's complement after finding out the 9's complement of that number. We have to add 1 with the 9's complement of any number to obtain the desired 10's complement of that number. Or if we want to find out the 10's complement directly, we can do it by following the following formula, (10n - number), where n = number of digits in the number. An example is given below to illustrate the concept of obtaining 10’s complement. Let us take a decimal number 456, 9's complement of this number will be: is the 10’s complement of 456