fundamentals of programming
play

Fundamentals of Programming Lecture 2 Hamed Rasifard Outline - PowerPoint PPT Presentation

Fundamentals of Programming Lecture 2 Hamed Rasifard Outline Numerical Systems Converting Numbers Summation and Subtraction of Binary Numbers Numerical Systems Binary (base 2) Octal (base 8) Decimal (Base 10)


  1. Fundamentals of Programming Lecture 2 Hamed Rasifard

  2. Outline • Numerical Systems • Converting Numbers • Summation and Subtraction of Binary Numbers

  3. Numerical Systems • Binary (base 2) • Octal (base 8) • Decimal (Base 10) • Hexadecimal (Base 16)

  4. Digits Binary Octal Decimal Hexadecimal 0 0 0 0 1 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 9 9 A B C D E F

  5. Numbers & Notation • Numbers: Binary: 101, 1100, 1001, 10011 Decimal: 101, 676, 245, 1470 Octal: 101, 345, 777 Hexadecimal:101, 234, 547E, A45CF • Notation Mention base: (101) 2 , (101) 10 , (345) 8

  6. Positional Value • (747) 10 = (7*100 + 4*10 + 7*1) 10 • (101) 2 = (1*100 + 0*10 + 1*1) 2 • (457) 8 = (4*100 + 5*10 + 7*1) 8

  7. Bits & Bytes • Memories consists of bits • Each bit could keep 0 or 1 • Every 8 bits make a Byte

  8. Converting Binary Numbers to Octal and Hexadecimal Numbers • Binary to Octal: Separate each 3 Bits and rewrite their equivalents (101011) 2 (53) 8 • Binary to Hexadecimal: Separate each 4 Bits and rewrite their equivalents (101011) 2 (2B) 16

  9. Converting Octal and Hexadecimal Numbers to Binary Numbers • Octal to Binary: write 3 binary digits for every octal digits (653) 8 (110101011) 2 • Hexadecimal to Binary: write 4 binary digits for every octal digits (FAD5) 16 (1111101011010101) 2

  10. Converting Octal and Hexadecimal and Binary to Decimal • Express base positional values in decimal (1*100 + 0*10 + 1*1) 2 =(1*2 2 + 0*2 1 + 1*2 0 ) 10 (1*100 + 0*10 + 1*1) 8 =(1*8 2 + 0*8 1 + 1*8 0 ) 10 (1*100 + 0*10 + 1*1) 16 =(1*16 2 + 0*16 1 + 1*16 0 ) 10

  11. Converting Decimal to Octal and Hexadecimal and Binary • write the positional values of the columns right to left • Find a column whose positional value is greater than the decimal number • From the leftmost column to the right divide number to positional values

  12. Represent Negative Numbers in Computer Systems • Bit-Sign • One’s complement notation • Two’s complement notation

  13. Summation and Subtraction in Computer Systems • Summation: Just ordinary add(consider overflow) • Subtraction: Add first number to two’s complement of second number

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend