SlideShare a Scribd company logo
5
Most read
6
Most read
11
Most read
DECIMAL TO BINARY CONVERSION
600 / 2 = 300 r 0 [least significant bit - lsb]
300 / 2 = 150 r 0
150 / 2 = 75 r 0
75 / 2 = 37 r 1
37 / 2 = 18 r 1
18 / 2 = 9 r 0
9 / 2 = 4 r 1
4 / 2 = 2 r 0
2 / 2 = 2 r 0
1 / 2 = 0 r 1 [most significant bit - msb]
Decimal to Hexadecimal Conversion
5789 ÷ 16 = 361 r 13 or D LSB
361 ÷ 16 = 22 r 9 or 9
22 ÷ 16 = 1 r 6 or 6
1 ÷ 16 = 0 r 1 or 1 MSB
5789 in decimal = 169D in hexadecimal.
Numeric Systems used in Computers
Input Output
0 = 1 Invert (NOT)
1 = 0
Inputs Output +---+
0 + 0 = 0 | 1 |
0 + 1 = 1 0R | 0 | (Not OR)
1 + 0 = 1 | 0 | NOR
1 + 1 = 1 | 0 |
+---+
Inputs Output +---+
0 x 0 = 0 | 1 |
0 x 1 = 0 AND| 1 |(Not AND)
1 x 0 = 0 | 1 |
1 x 1 = 1 | 0 |-----NAND
+---+
Inputs Output
0 + 0 = 00
0 + 1 = 01 ADD
1 + 0 = 01
1 + 1 = 10
Negative numbers
On paper, a negative number is represented by a dash – in front of
the number. A computer can only work with 0's and 1's. A dash is
not possible.
An 8-bit binary number (data type 'int' in C, 'byte' in Java) can be
used to represent negative numbers by 'hijacking' the MSB for use
as a 'sign bit'. With 8 bits you can represent numbers which range
from:
(Sign bit)+ ----->0] 0 0 0 0 0 0 0 (+0 in decimal)
(Sign bit)- ----->1] 0 0 0 0 0 0 0 (-0 in decimal)
(Sign bit)+ ----->0] 1 1 1 1 1 1 1 (+127 in decimal)
(Sign bit)- ----->1] 1 1 1 1 1 1 1 (-127 in decimal)
The first number represents whether the number is positive or
negative.
0 = + 1 = -
For example::
00000111 represents 7 in decimal
10000111 represents -7 in decimal
So:
00000000 to 01111111 represents 0 to 127
and
10000000 to 11111111 represents 0 to -127
Notice that there are two representations for zero
00000000 and 10000000
Complementary numbers
Complementary numbers are found by counting backwards from the
highest number available. For an 8-bit number this is:
11111111
Counting backwards we get::
11111111 = -0
11111110 = -1
11111101 = -2
11111100 = -3
11111011 = -4
This is known as the 1's complement of a positive number.
So a complementary number is an inverted 'normal' number, where
a negative number is made by 'bitwise inverting' the positive
number.
00000000 = +0
11111111 = -0 (silly)
00000001 = +1
11111110 = -1
00000010 = +2
11111101 = -2
Notice that 00000000 and 11111111 both represent zero, which
is a 'waste' of a binary number.
To make better use of the complementary number range, it would
make better sense to let 00000000 represent zero, and 11111111
to represent -1 instead of -0, which is silly.
So take the 1's complement and add 1 to it. Now it is 11111111 that
represents -1 rather than 11111110. This is shown here:
11111110 + 00000001 = 11111111 = (or represents) -1
11111101 + 00000001 = 11111110 = (or represents) -2
11111100 + 00000001 = 11111101 = (or represents) -3
11111011 + 00000001 = 11111100 = (or represents) -4
11111010 + 00000001 = 11111011 = (or represents) -5
11111001 + 00000001 = 11111010 = (or represents) -6
11111000 + 00000001 = 11111001 = (or represents) -7
1's complement + 1 = 2's complement
So 1's complement + 1 is known as the 'true' or 2's complement.
So.
To find a 2's complement representation of (say) the number -7
start with +7, ie.
00000111
Then invert (NOT) every bit to get the 1's complement.
11111000
Then add 1 to the number to get the 2's complement.
11111000 + 1 = 11111001
The MSB is a 1 so the number is negative, and this number now
REPRESENTS -7 for calculation purposes.
Subtraction in Binary
Computers can only move binary information, and add it together.
They cannot directly perform multiplication, subtraction or division.
Subtraction of two binary numbers can only be done in a computer
by adding together the normal representation of a positive number to
the 2's complement of the negative number.
For example::
45 - 20 = 25
This can be expressed as:
+45 + (-20) = +25
+45 = 0010 1101 normal representation
+20 = 0001 0100 normal representation
-20 = 1110 1011 1's complement
+ 0000 0001 add 1 to give:
-20 = 1110 1100 2's complement
Note the process to get the 2's complement
Now add:
+45 = 0010 1101 normal representation
-20 = 1110 1100 2's complement
= (1)0001 1001
= 25 in decimal
The "overflow" 9th bit above is ignored.

More Related Content

PPTX
Convert decimal to binary
PPT
Logic design and switching theory
PPT
Binary to Decimal Conversion
PPTX
Basics of digital electronics
PPTX
PPT
Decimal to binary number
PPT
BCD,GRAY and EXCESS 3 codes
Convert decimal to binary
Logic design and switching theory
Binary to Decimal Conversion
Basics of digital electronics
Decimal to binary number
BCD,GRAY and EXCESS 3 codes

What's hot (20)

PDF
Boolean algebra & logic gates
PPT
Logic gates presentation
PPTX
Hexa to binary
PPTX
Multiplication & division instructions microprocessor 8086
PPTX
Logic Gates
PPT
PPTX
1.1.2 HEXADECIMAL
PPT
binary number system
PPTX
Logic gates
PPTX
Convert Hexadecimal to decimal
PPTX
Binary number system
PPTX
Sequence Types in Python Programming
PPT
CMOS Logic Circuits
PPTX
Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.
PPT
Mosfet
PPTX
Internal architecture-of-8086
PPT
Design of optimum self cascode low voltage current mirror
PPT
decoder and encoder
PPTX
DIGITAL ELECTRONICS- Number System
PPTX
ICT Basic Logic Gates Lessons.pptx
Boolean algebra & logic gates
Logic gates presentation
Hexa to binary
Multiplication & division instructions microprocessor 8086
Logic Gates
1.1.2 HEXADECIMAL
binary number system
Logic gates
Convert Hexadecimal to decimal
Binary number system
Sequence Types in Python Programming
CMOS Logic Circuits
Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.
Mosfet
Internal architecture-of-8086
Design of optimum self cascode low voltage current mirror
decoder and encoder
DIGITAL ELECTRONICS- Number System
ICT Basic Logic Gates Lessons.pptx
Ad

Viewers also liked (18)

PPTX
Ch1.number systems
PDF
Digital and Logic Design Chapter 1 binary_systems
PPT
Intro to decimals
PPTX
Conversion binary to decimal
PPT
digital logic design number system
PDF
Math1003 1.9 - Converting Decimal to Binary and Hex
PPT
Folk dance
PPT
Ch 2 Decimals Powerpoint
PPT
Decimal Numbers
PPT
BINARY NUMBER SYSTEM
PPT
Introduction to the Binary Number System
PPTX
Fractions And Decimals
PDF
Fractions and decimals made easy
PPTX
Fundamental positions of arms and feet in Folk Dance
PPT
Number System
PPT
Computer network ppt
PPTX
Decimal powerpoint presentation
PPTX
Introduction to computer network
Ch1.number systems
Digital and Logic Design Chapter 1 binary_systems
Intro to decimals
Conversion binary to decimal
digital logic design number system
Math1003 1.9 - Converting Decimal to Binary and Hex
Folk dance
Ch 2 Decimals Powerpoint
Decimal Numbers
BINARY NUMBER SYSTEM
Introduction to the Binary Number System
Fractions And Decimals
Fractions and decimals made easy
Fundamental positions of arms and feet in Folk Dance
Number System
Computer network ppt
Decimal powerpoint presentation
Introduction to computer network
Ad

Similar to Decimal to Binary Conversion (20)

PDF
Working With Binary Numbers
PPT
Number system and codes
PDF
Notes unit 2
PPTX
Data Representation
PPT
Fundamentals of Electrical and electronic engineering Binary code,grey code,o...
PPTX
Data Representation
PDF
NumberSystemsAnnotated.pdf
PPT
09 Arithmetic
PDF
MODULmds kletmlskaf,lwmeltlwtm,reltm,lgglsekpwrpo
PDF
unit-2_DL.pdf
PPT
ch3a-binary-numbers.ppt
PPT
Logic Design - Chapter 1: Number Systems and Codes
PPT
Mba admission in india
PDF
Number system
PPT
mmmmmmmmmmmmmmmmmmmmmmbinary-numbers.ppt
PPT
binary-numbers.ppt
PPT
ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt
PPT
Review on Number Systems: Decimal, Binary, and Hexadecimal
PPT
ch3a-binary-numbers.ppt
PPT
ch3a-binary-numbers.ppt
Working With Binary Numbers
Number system and codes
Notes unit 2
Data Representation
Fundamentals of Electrical and electronic engineering Binary code,grey code,o...
Data Representation
NumberSystemsAnnotated.pdf
09 Arithmetic
MODULmds kletmlskaf,lwmeltlwtm,reltm,lgglsekpwrpo
unit-2_DL.pdf
ch3a-binary-numbers.ppt
Logic Design - Chapter 1: Number Systems and Codes
Mba admission in india
Number system
mmmmmmmmmmmmmmmmmmmmmmbinary-numbers.ppt
binary-numbers.ppt
ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt
Review on Number Systems: Decimal, Binary, and Hexadecimal
ch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt

More from adil raja (20)

PDF
ANNs.pdf
PDF
A Software Requirements Specification
PDF
NUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
PDF
DevOps Demystified
PDF
On Research (And Development)
PDF
Simulators as Drivers of Cutting Edge Research
PDF
The Knock Knock Protocol
PDF
File Transfer Through Sockets
PDF
Remote Command Execution
PDF
Thesis
PDF
CMM Level 3 Assessment of Xavor Pakistan
PDF
Data Warehousing
PDF
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
PDF
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
PDF
Real-Time Non-Intrusive Speech Quality Estimation for VoIP
PDF
VoIP
PDF
ULMAN GUI Specifications
PDF
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
PDF
ULMAN-GUI
PDF
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
ANNs.pdf
A Software Requirements Specification
NUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
DevOps Demystified
On Research (And Development)
Simulators as Drivers of Cutting Edge Research
The Knock Knock Protocol
File Transfer Through Sockets
Remote Command Execution
Thesis
CMM Level 3 Assessment of Xavor Pakistan
Data Warehousing
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Real-Time Non-Intrusive Speech Quality Estimation for VoIP
VoIP
ULMAN GUI Specifications
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
ULMAN-GUI
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...

Recently uploaded (20)

PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PPTX
Funds Management Learning Material for Beg
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PPTX
artificial intelligence overview of it and more
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PPTX
Introduction to Information and Communication Technology
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
DOCX
Unit-3 cyber security network security of internet system
PDF
Introduction to the IoT system, how the IoT system works
PDF
The Internet -By the Numbers, Sri Lanka Edition
PPTX
presentation_pfe-universite-molay-seltan.pptx
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PPTX
international classification of diseases ICD-10 review PPT.pptx
PPTX
innovation process that make everything different.pptx
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
Funds Management Learning Material for Beg
Module 1 - Cyber Law and Ethics 101.pptx
Slides PDF The World Game (s) Eco Economic Epochs.pdf
artificial intelligence overview of it and more
INTERNET------BASICS-------UPDATED PPT PRESENTATION
Decoding a Decade: 10 Years of Applied CTI Discipline
Cloud-Scale Log Monitoring _ Datadog.pdf
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
Introduction to Information and Communication Technology
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Unit-3 cyber security network security of internet system
Introduction to the IoT system, how the IoT system works
The Internet -By the Numbers, Sri Lanka Edition
presentation_pfe-universite-molay-seltan.pptx
An introduction to the IFRS (ISSB) Stndards.pdf
international classification of diseases ICD-10 review PPT.pptx
innovation process that make everything different.pptx

Decimal to Binary Conversion

  • 1. DECIMAL TO BINARY CONVERSION 600 / 2 = 300 r 0 [least significant bit - lsb] 300 / 2 = 150 r 0 150 / 2 = 75 r 0 75 / 2 = 37 r 1 37 / 2 = 18 r 1 18 / 2 = 9 r 0 9 / 2 = 4 r 1 4 / 2 = 2 r 0 2 / 2 = 2 r 0 1 / 2 = 0 r 1 [most significant bit - msb]
  • 2. Decimal to Hexadecimal Conversion 5789 ÷ 16 = 361 r 13 or D LSB 361 ÷ 16 = 22 r 9 or 9 22 ÷ 16 = 1 r 6 or 6 1 ÷ 16 = 0 r 1 or 1 MSB 5789 in decimal = 169D in hexadecimal.
  • 3. Numeric Systems used in Computers Input Output 0 = 1 Invert (NOT) 1 = 0 Inputs Output +---+ 0 + 0 = 0 | 1 | 0 + 1 = 1 0R | 0 | (Not OR) 1 + 0 = 1 | 0 | NOR 1 + 1 = 1 | 0 | +---+ Inputs Output +---+ 0 x 0 = 0 | 1 | 0 x 1 = 0 AND| 1 |(Not AND) 1 x 0 = 0 | 1 | 1 x 1 = 1 | 0 |-----NAND +---+ Inputs Output 0 + 0 = 00 0 + 1 = 01 ADD 1 + 0 = 01 1 + 1 = 10
  • 4. Negative numbers On paper, a negative number is represented by a dash – in front of the number. A computer can only work with 0's and 1's. A dash is not possible. An 8-bit binary number (data type 'int' in C, 'byte' in Java) can be used to represent negative numbers by 'hijacking' the MSB for use as a 'sign bit'. With 8 bits you can represent numbers which range from: (Sign bit)+ ----->0] 0 0 0 0 0 0 0 (+0 in decimal) (Sign bit)- ----->1] 0 0 0 0 0 0 0 (-0 in decimal) (Sign bit)+ ----->0] 1 1 1 1 1 1 1 (+127 in decimal) (Sign bit)- ----->1] 1 1 1 1 1 1 1 (-127 in decimal) The first number represents whether the number is positive or negative. 0 = + 1 = -
  • 5. For example:: 00000111 represents 7 in decimal 10000111 represents -7 in decimal So: 00000000 to 01111111 represents 0 to 127 and 10000000 to 11111111 represents 0 to -127 Notice that there are two representations for zero 00000000 and 10000000
  • 6. Complementary numbers Complementary numbers are found by counting backwards from the highest number available. For an 8-bit number this is: 11111111 Counting backwards we get:: 11111111 = -0 11111110 = -1 11111101 = -2 11111100 = -3 11111011 = -4 This is known as the 1's complement of a positive number.
  • 7. So a complementary number is an inverted 'normal' number, where a negative number is made by 'bitwise inverting' the positive number. 00000000 = +0 11111111 = -0 (silly) 00000001 = +1 11111110 = -1 00000010 = +2 11111101 = -2 Notice that 00000000 and 11111111 both represent zero, which is a 'waste' of a binary number.
  • 8. To make better use of the complementary number range, it would make better sense to let 00000000 represent zero, and 11111111 to represent -1 instead of -0, which is silly. So take the 1's complement and add 1 to it. Now it is 11111111 that represents -1 rather than 11111110. This is shown here: 11111110 + 00000001 = 11111111 = (or represents) -1 11111101 + 00000001 = 11111110 = (or represents) -2 11111100 + 00000001 = 11111101 = (or represents) -3 11111011 + 00000001 = 11111100 = (or represents) -4 11111010 + 00000001 = 11111011 = (or represents) -5 11111001 + 00000001 = 11111010 = (or represents) -6 11111000 + 00000001 = 11111001 = (or represents) -7 1's complement + 1 = 2's complement So 1's complement + 1 is known as the 'true' or 2's complement.
  • 9. So. To find a 2's complement representation of (say) the number -7 start with +7, ie. 00000111 Then invert (NOT) every bit to get the 1's complement. 11111000 Then add 1 to the number to get the 2's complement. 11111000 + 1 = 11111001 The MSB is a 1 so the number is negative, and this number now REPRESENTS -7 for calculation purposes.
  • 10. Subtraction in Binary Computers can only move binary information, and add it together. They cannot directly perform multiplication, subtraction or division. Subtraction of two binary numbers can only be done in a computer by adding together the normal representation of a positive number to the 2's complement of the negative number. For example:: 45 - 20 = 25 This can be expressed as: +45 + (-20) = +25
  • 11. +45 = 0010 1101 normal representation +20 = 0001 0100 normal representation -20 = 1110 1011 1's complement + 0000 0001 add 1 to give: -20 = 1110 1100 2's complement Note the process to get the 2's complement Now add: +45 = 0010 1101 normal representation -20 = 1110 1100 2's complement = (1)0001 1001 = 25 in decimal The "overflow" 9th bit above is ignored.