SlideShare a Scribd company logo
Numeral Systems Binary, Decimal and Hexadecimal Numbers Svetlin Nakov Telerik Corporation www.telerik.com
Table of Contents Numerals Systems Binary and Decimal Numbers Hexadecimal Numbers Conversion between Numeral Systems Representation of Numbers Positive and Negative Integer Numbers Floating-Point Numbers Text Representation
Numeral Systems Conversion between Numeral Systems
Decimal numbers (base  10 ) Represented using  10  numerals:  0 ,  1 ,  2 ,  3 ,  4 ,  5 ,  6 ,  7 ,  8 ,  9 Each position represents a power of  10 :  4 0 1 =  4 *10 2  +  0 *10 1  +  1 *10 0  =  400  +  1 1 3 0 =  1 *10 2  +  3 *10 1  +   0 *10 0  =  100  +  30 9 7 8 6 =  9 *10 3  +  7 *10 2  +  8 *10 1  +  6 *10 0  = =  9 *1000 +   7 *100 +  8 *10 +  6 *1  Decimal Numbers
Binary Numeral System 1  0  1  1  0  0  1  0 1  0  0  1  0  0  1  0 1  0  0  1  0  0  1  1 1  1  1  1  1  1  1  1 Binary numbers are represented by sequence of bits (smallest unit of information –  0  or  1 ) Bits are easy to represent in electronics
Binary numbers (base  2 ) Represented by  2  numerals:  0  and  1 Each position represents a power of  2 :  1 0 1 b =  1 *2 2  +  0 *2 1  +  1 *2 0  =  100 b  +  1 b   =  4   +   1   = = 5 1 1 0 b =  1 *2 2  +  1 *2 1  +  0 *2 0  =  100 b  +  10 b  =  4   +   2   = = 6 1 1 0 1 0 1 b =  1 *2 5  +  1 *2 4  +  0 *2 3  +  1 *2 2  +  0 *2 1   +  1 *2 0   = =  32  +  16  +  4  +  1  = =  53 Binary Numbers
Binary to Decimal Conversion Multiply each numeral by its exponent: 1 0 0 1 b =  1 *2 3 +  1 *2 0 =  1 *8 +  1 *1 = = 9 0 1 1 1 b =  0 *2 3 +  1 *2 2 +  1 *2 1 +  1 *2 0 = =  100 b +  10 b +  1 b   =  4  +  2  +  1  = = 7 1 1 0 1 1 0 b =  1 *2 5 +  1 *2 4 +  0 *2 3  +  1 *2 2  +  1 *2 1   =  =  100000 b  +  10000 b  +  100 b  +  10 b  =  =  32  +  16  +  4  +  2  =  = 54
Decimal to Binary Conversion Divide by  2  and append the reminders in reversed order: 500/2  = 250 (0) 250/2  = 125 (0) 125/2  = 62  (1) 62/2  = 31  (0)  500 d  = 111110100 b 31/2  = 15  (1) 15/2  = 7  (1) 7/2  = 3  (1) 3/2  = 1  (1) 1/2  = 0  (1)
Hexadecimal Numbers Hexadecimal numbers (base  16 ) Represented using  16  numerals:  0 ,  1 ,  2 , ...  9 ,  A ,  B ,  C ,  D ,  E  and  F Usually prefixed with  0x 0    0x0  8    0x8 1    0x1  9    0x9 2    0x2 10    0xA 3    0x3 11    0xB 4    0x4 12    0xC 5    0x5 13    0xD 6    0x6 14    0xE 7    0x7 15    0xF
Hexadecimal Numbers (2) Each position represents a power of  16 :  9 7 8 6 hex =  9 *16 3 +  7 *16 2 +  8 *16 1 +  6 *16 0 = =  9 *4096 +  7 *256 +  8 *16 +  6 *1 = = 38790 0x A B C D E F hex =  10 *16 5  +  11 *16 4  +  12 *16 3  +   13 *16 2  +  14 *16 1  +   15 *16 0  = = 11259375
Hexadecimal to Decimal Conversion Multiply each digit by its exponent 1 F 4 hex =   1 *16 2 +  15 *16 1 +  4 *16 0  = =  1 *256 +  15 *16 +  4 *1 = =   500 d F F hex =  15 *16 1 +  15 *16 0 = =  240 +  15 = = 255 d
Decimal to Hexadecimal Conversion Divide by  16  and append the reminders in reversed order 500/16 = 31 (4)  31/16  = 1 (F)  500 d  = 1F4 hex 1/16  = 0 (1)
Binary to Hexadecimal (and Back) Conversion The conversion from binary to hexadecimal (and back) is straightforward: each hex digit corresponds to a sequence of  4  binary digits: 0x0 = 0000 0x8 = 1000 0x1 = 0001 0x9 = 1001 0x2 = 0010 0xA = 1010 0x3 = 0011 0xB = 1011 0x4 = 0100 0xC = 1100 0x5 = 0101 0xD = 1101 0x6 = 0110 0xE = 1110 0x7 = 0111 0xF = 1111
Numbers Representation Positive and Negative Integers and Floating-Point Numbers
Representation of Integers A  short  is represented by  16  bits   100 = 2 6  + 2 5  + 2 2  = = 00000000 01100100 An  int  is represented by  32  bits  65545 = 2 16  + 2 3  + 2 0  = = 00000000 00000001 00000000 00001001 A  char  is represented by  16  bits  ‘ 0’ = 48 = 2 5  + 2 4  = = 00000000 00110000
Positive and Negative Numbers A number's sign is determined by the Most Significant Bit   (MSB) Only in signed integers:  sbyte ,  short ,  int ,  long Leading  0  means positive number Leading  1  means negative number Example: (8 bit numbers) 0XXXXXXX b  > 0 e.g.  00010010 b  = 18 00000000 b   = 0 1XXXXXXX b  < 0 e.g.  10010010 b  = -110
Positive and Negative Numbers (2) The largest positive 8-bit  sbyte  number is: 127   ( 2 7   -   1 ) =  01111111 b The smallest negative 8-bit number is: -128  ( -2 7 ) =  10000000 b The largest positive  32 -bit  int  number is: 2   147   483   647   ( 2 31   -   1 ) =  01111…11111 b The smallest negative  32 -bit number is: -2   147   483   648  ( -2 31 ) =  10000…00000 b
Representation of 8-bit Numbers +127 = 01111111 ... +3 = 00000011 +2 = 00000010 +1 = 00000001 +0 = 00000000 -1 = 11111111 -2 = 11111110 -3 = 11111101 ... -127 = 10000001 -128 = 10000000 Positive 8-bit numbers have the format  0XXXXXXX Their value is the decimal of their last  7  bits ( XXXXXXX) Negative 8-bit numbers have the format  1YYYYYYY Their value is  128  ( 2 7 ) minus ( - ) the decimal of  YYYYYYY 10010010 b   =   2 7   –   10010 b   = = 128   -   18   =   -110
Floating-Point Numbers Floating-point numbers representation (according to the IEEE  754  standard*): Example: 1 10000011 01010010100000000000000 Mantissa =  1,3222656 25 Exponent = 4 Sign  =  - 1 Bits [2 2 … 0 ] Bits [3 0 … 23 ] Bit  31 * See  http://en.wikipedia.org/wiki/Floating_point 2 k - 1 2 0 2 - 1 2 - 2 2 - n S P 0 ... P k - 1 M 0 M 1 ... M n - 1 Sign Exponent Mantissa
Text Representation in Computer Systems
How Computers Represent Text Data? A  text encoding  is a system that uses binary numbers ( 1  and  0 ) to   represent characters Letters, numerals, etc.  In the ASCII encoding each character consists of 8 bits (one byte) of data ASCII is used in nearly all personal computers In the Unicode encoding each character consists of 16 bits (two bytes) of data Can represent many alphabets
Character Codes – ASCII Table Excerpt from the ASCII table Binary Code Decimal Code Character 01000001 65 A 01000010 66 B 01000011 67 C 01000100 68 D 0 0100011 35 # 011 0 0000 48 0 00110001 49 1 01111110 126 ~
Strings of Characters Strings are sequences of characters Null-terminated (like in C) Represented by array Characters in the strings can be: 8 bit (ASCII / windows- 1251  / …) 16  bit (UTF- 16 ) … … … … … … … … \0 4 bytes length … … … … … …
Numeral Systems http://academy.telerik.com
Exercises Write a program to convert decimal numbers to their binary representation. Write a program to convert binary numbers to their decimal representation. Write a program to convert decimal numbers to their hexadecimal representation. Write a program to convert hexadecimal numbers to their decimal representation. Write a program to convert hexadecimal numbers to binary numbers (directly). Write a program to convert binary numbers to hexadecimal numbers (directly).
Exercises (2) Write a program to convert from any numeral system of given base  s  to any other numeral system of base  d  ( 2  ≤  s ,  d  ≤  16 ). Write a program that shows the binary representation of given  16 -bit signed integer number (the C# type  short ). * Write a program that shows the internal binary representation of given  32 -bit signed floating-point number in IEEE  754  format (the C# type  float ). Example:  -27,25     sign =  1 , exponent =  10000011 , mantissa =  10110100000000000000000 .

More Related Content

PDF
Decimal to Binary Conversion
PPTX
Number System & Data Representation
PPTX
2.1 data represent on cpu
PPTX
ALL ABOUT NUMBER SYSTEMS
PPTX
Number systems
PDF
Number system
PPTX
data representation
PDF
Number system
Decimal to Binary Conversion
Number System & Data Representation
2.1 data represent on cpu
ALL ABOUT NUMBER SYSTEMS
Number systems
Number system
data representation
Number system

What's hot (20)

PDF
Number Systems
PPTX
Data representation
PDF
chapter one && two.pdf
PPTX
Bitwise Operations in Programming
PPT
Lec 02 data representation part 1
PPT
Data representation moris mano ch 03
PPTX
Data Representation
PPTX
Data Representation
PPTX
Understand data representation on CPU 1
PPT
Number system and codes
PPTX
PPTX
Data representation
PPTX
Number Systems and Binary Aritmetics
PDF
Data representation in computers
PPTX
Data representation
PPTX
11 octal number system
PPTX
Introduction of number system
PDF
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
PPTX
Number system
PPTX
Computer architecture data representation
Number Systems
Data representation
chapter one && two.pdf
Bitwise Operations in Programming
Lec 02 data representation part 1
Data representation moris mano ch 03
Data Representation
Data Representation
Understand data representation on CPU 1
Number system and codes
Data representation
Number Systems and Binary Aritmetics
Data representation in computers
Data representation
11 octal number system
Introduction of number system
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
Number system
Computer architecture data representation
Ad

Similar to 08. Numeral Systems (20)

PPT
08 Numeral systems
PPT
Cit 1101 lec 02
PPTX
Digital Logic Design.pptx
PPT
ENG241-Week1-NumberSystemsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
PDF
Number system
PDF
Digital electronics number system notes
PPT
IS 139 Lecture 4
PPT
IS 139 Lecture 4 - 2015
PDF
Digital Electronics – Unit I.pdf
PDF
Number Systems
PPT
Number Systems.ppt
PPTX
Binary, Decimal and Hexadecimal
PPTX
1.Digital Electronics overview & Number Systems.pptx
PPTX
Lesson4.1 u4 l1 binary representation
PDF
Introduction to Computing - Basic Theories Of Information
PPT
DL&CO - Unit 1 PPT.ppt DL&CO - Unit 1 PPT.ppt DL&CO - Unit 1 PPT.ppt
PPT
1. basic theories of information
PPT
digitalelectronics.ppt
08 Numeral systems
Cit 1101 lec 02
Digital Logic Design.pptx
ENG241-Week1-NumberSystemsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Number system
Digital electronics number system notes
IS 139 Lecture 4
IS 139 Lecture 4 - 2015
Digital Electronics – Unit I.pdf
Number Systems
Number Systems.ppt
Binary, Decimal and Hexadecimal
1.Digital Electronics overview & Number Systems.pptx
Lesson4.1 u4 l1 binary representation
Introduction to Computing - Basic Theories Of Information
DL&CO - Unit 1 PPT.ppt DL&CO - Unit 1 PPT.ppt DL&CO - Unit 1 PPT.ppt
1. basic theories of information
digitalelectronics.ppt
Ad

More from Intro C# Book (20)

PPTX
17. Java data structures trees representation and traversal
PPTX
Java Problem solving
PPTX
21. Java High Quality Programming Code
PPTX
20.5 Java polymorphism
PPTX
20.4 Java interfaces and abstraction
PPTX
20.3 Java encapsulation
PPTX
20.2 Java inheritance
PPTX
20.1 Java working with abstraction
PPTX
19. Java data structures algorithms and complexity
PPTX
18. Java associative arrays
PPTX
16. Java stacks and queues
PPTX
14. Java defining classes
PPTX
13. Java text processing
PPTX
12. Java Exceptions and error handling
PPTX
11. Java Objects and classes
PPTX
09. Java Methods
PPTX
05. Java Loops Methods and Classes
PPTX
07. Java Array, Set and Maps
PPTX
03 and 04 .Operators, Expressions, working with the console and conditional s...
PPTX
02. Data Types and variables
17. Java data structures trees representation and traversal
Java Problem solving
21. Java High Quality Programming Code
20.5 Java polymorphism
20.4 Java interfaces and abstraction
20.3 Java encapsulation
20.2 Java inheritance
20.1 Java working with abstraction
19. Java data structures algorithms and complexity
18. Java associative arrays
16. Java stacks and queues
14. Java defining classes
13. Java text processing
12. Java Exceptions and error handling
11. Java Objects and classes
09. Java Methods
05. Java Loops Methods and Classes
07. Java Array, Set and Maps
03 and 04 .Operators, Expressions, working with the console and conditional s...
02. Data Types and variables

Recently uploaded (20)

PDF
Mushroom cultivation and it's methods.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
August Patch Tuesday
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
Hybrid model detection and classification of lung cancer
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Encapsulation theory and applications.pdf
PPTX
A Presentation on Touch Screen Technology
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
Mushroom cultivation and it's methods.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Approach and Philosophy of On baking technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Encapsulation_ Review paper, used for researhc scholars
Enhancing emotion recognition model for a student engagement use case through...
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
August Patch Tuesday
Assigned Numbers - 2025 - Bluetooth® Document
Univ-Connecticut-ChatGPT-Presentaion.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Hybrid model detection and classification of lung cancer
Group 1 Presentation -Planning and Decision Making .pptx
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Encapsulation theory and applications.pdf
A Presentation on Touch Screen Technology
Building Integrated photovoltaic BIPV_UPV.pdf

08. Numeral Systems

  • 1. Numeral Systems Binary, Decimal and Hexadecimal Numbers Svetlin Nakov Telerik Corporation www.telerik.com
  • 2. Table of Contents Numerals Systems Binary and Decimal Numbers Hexadecimal Numbers Conversion between Numeral Systems Representation of Numbers Positive and Negative Integer Numbers Floating-Point Numbers Text Representation
  • 3. Numeral Systems Conversion between Numeral Systems
  • 4. Decimal numbers (base 10 ) Represented using 10 numerals: 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 Each position represents a power of 10 : 4 0 1 = 4 *10 2 + 0 *10 1 + 1 *10 0 = 400 + 1 1 3 0 = 1 *10 2 + 3 *10 1 + 0 *10 0 = 100 + 30 9 7 8 6 = 9 *10 3 + 7 *10 2 + 8 *10 1 + 6 *10 0 = = 9 *1000 + 7 *100 + 8 *10 + 6 *1 Decimal Numbers
  • 5. Binary Numeral System 1 0 1 1 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 Binary numbers are represented by sequence of bits (smallest unit of information – 0 or 1 ) Bits are easy to represent in electronics
  • 6. Binary numbers (base 2 ) Represented by 2 numerals: 0 and 1 Each position represents a power of 2 : 1 0 1 b = 1 *2 2 + 0 *2 1 + 1 *2 0 = 100 b + 1 b = 4 + 1 = = 5 1 1 0 b = 1 *2 2 + 1 *2 1 + 0 *2 0 = 100 b + 10 b = 4 + 2 = = 6 1 1 0 1 0 1 b = 1 *2 5 + 1 *2 4 + 0 *2 3 + 1 *2 2 + 0 *2 1 + 1 *2 0 = = 32 + 16 + 4 + 1 = = 53 Binary Numbers
  • 7. Binary to Decimal Conversion Multiply each numeral by its exponent: 1 0 0 1 b = 1 *2 3 + 1 *2 0 = 1 *8 + 1 *1 = = 9 0 1 1 1 b = 0 *2 3 + 1 *2 2 + 1 *2 1 + 1 *2 0 = = 100 b + 10 b + 1 b = 4 + 2 + 1 = = 7 1 1 0 1 1 0 b = 1 *2 5 + 1 *2 4 + 0 *2 3 + 1 *2 2 + 1 *2 1 = = 100000 b + 10000 b + 100 b + 10 b = = 32 + 16 + 4 + 2 = = 54
  • 8. Decimal to Binary Conversion Divide by 2 and append the reminders in reversed order: 500/2 = 250 (0) 250/2 = 125 (0) 125/2 = 62 (1) 62/2 = 31 (0) 500 d = 111110100 b 31/2 = 15 (1) 15/2 = 7 (1) 7/2 = 3 (1) 3/2 = 1 (1) 1/2 = 0 (1)
  • 9. Hexadecimal Numbers Hexadecimal numbers (base 16 ) Represented using 16 numerals: 0 , 1 , 2 , ... 9 , A , B , C , D , E and F Usually prefixed with 0x 0  0x0 8  0x8 1  0x1 9  0x9 2  0x2 10  0xA 3  0x3 11  0xB 4  0x4 12  0xC 5  0x5 13  0xD 6  0x6 14  0xE 7  0x7 15  0xF
  • 10. Hexadecimal Numbers (2) Each position represents a power of 16 : 9 7 8 6 hex = 9 *16 3 + 7 *16 2 + 8 *16 1 + 6 *16 0 = = 9 *4096 + 7 *256 + 8 *16 + 6 *1 = = 38790 0x A B C D E F hex = 10 *16 5 + 11 *16 4 + 12 *16 3 + 13 *16 2 + 14 *16 1 + 15 *16 0 = = 11259375
  • 11. Hexadecimal to Decimal Conversion Multiply each digit by its exponent 1 F 4 hex = 1 *16 2 + 15 *16 1 + 4 *16 0 = = 1 *256 + 15 *16 + 4 *1 = = 500 d F F hex = 15 *16 1 + 15 *16 0 = = 240 + 15 = = 255 d
  • 12. Decimal to Hexadecimal Conversion Divide by 16 and append the reminders in reversed order 500/16 = 31 (4) 31/16 = 1 (F) 500 d = 1F4 hex 1/16 = 0 (1)
  • 13. Binary to Hexadecimal (and Back) Conversion The conversion from binary to hexadecimal (and back) is straightforward: each hex digit corresponds to a sequence of 4 binary digits: 0x0 = 0000 0x8 = 1000 0x1 = 0001 0x9 = 1001 0x2 = 0010 0xA = 1010 0x3 = 0011 0xB = 1011 0x4 = 0100 0xC = 1100 0x5 = 0101 0xD = 1101 0x6 = 0110 0xE = 1110 0x7 = 0111 0xF = 1111
  • 14. Numbers Representation Positive and Negative Integers and Floating-Point Numbers
  • 15. Representation of Integers A short is represented by 16 bits 100 = 2 6 + 2 5 + 2 2 = = 00000000 01100100 An int is represented by 32 bits 65545 = 2 16 + 2 3 + 2 0 = = 00000000 00000001 00000000 00001001 A char is represented by 16 bits ‘ 0’ = 48 = 2 5 + 2 4 = = 00000000 00110000
  • 16. Positive and Negative Numbers A number's sign is determined by the Most Significant Bit (MSB) Only in signed integers: sbyte , short , int , long Leading 0 means positive number Leading 1 means negative number Example: (8 bit numbers) 0XXXXXXX b > 0 e.g. 00010010 b = 18 00000000 b = 0 1XXXXXXX b < 0 e.g. 10010010 b = -110
  • 17. Positive and Negative Numbers (2) The largest positive 8-bit sbyte number is: 127 ( 2 7 - 1 ) = 01111111 b The smallest negative 8-bit number is: -128 ( -2 7 ) = 10000000 b The largest positive 32 -bit int number is: 2 147 483 647 ( 2 31 - 1 ) = 01111…11111 b The smallest negative 32 -bit number is: -2 147 483 648 ( -2 31 ) = 10000…00000 b
  • 18. Representation of 8-bit Numbers +127 = 01111111 ... +3 = 00000011 +2 = 00000010 +1 = 00000001 +0 = 00000000 -1 = 11111111 -2 = 11111110 -3 = 11111101 ... -127 = 10000001 -128 = 10000000 Positive 8-bit numbers have the format 0XXXXXXX Their value is the decimal of their last 7 bits ( XXXXXXX) Negative 8-bit numbers have the format 1YYYYYYY Their value is 128 ( 2 7 ) minus ( - ) the decimal of YYYYYYY 10010010 b = 2 7 – 10010 b = = 128 - 18 = -110
  • 19. Floating-Point Numbers Floating-point numbers representation (according to the IEEE 754 standard*): Example: 1 10000011 01010010100000000000000 Mantissa = 1,3222656 25 Exponent = 4 Sign = - 1 Bits [2 2 … 0 ] Bits [3 0 … 23 ] Bit 31 * See http://en.wikipedia.org/wiki/Floating_point 2 k - 1 2 0 2 - 1 2 - 2 2 - n S P 0 ... P k - 1 M 0 M 1 ... M n - 1 Sign Exponent Mantissa
  • 20. Text Representation in Computer Systems
  • 21. How Computers Represent Text Data? A text encoding is a system that uses binary numbers ( 1 and 0 ) to represent characters Letters, numerals, etc. In the ASCII encoding each character consists of 8 bits (one byte) of data ASCII is used in nearly all personal computers In the Unicode encoding each character consists of 16 bits (two bytes) of data Can represent many alphabets
  • 22. Character Codes – ASCII Table Excerpt from the ASCII table Binary Code Decimal Code Character 01000001 65 A 01000010 66 B 01000011 67 C 01000100 68 D 0 0100011 35 # 011 0 0000 48 0 00110001 49 1 01111110 126 ~
  • 23. Strings of Characters Strings are sequences of characters Null-terminated (like in C) Represented by array Characters in the strings can be: 8 bit (ASCII / windows- 1251 / …) 16 bit (UTF- 16 ) … … … … … … … … \0 4 bytes length … … … … … …
  • 25. Exercises Write a program to convert decimal numbers to their binary representation. Write a program to convert binary numbers to their decimal representation. Write a program to convert decimal numbers to their hexadecimal representation. Write a program to convert hexadecimal numbers to their decimal representation. Write a program to convert hexadecimal numbers to binary numbers (directly). Write a program to convert binary numbers to hexadecimal numbers (directly).
  • 26. Exercises (2) Write a program to convert from any numeral system of given base s to any other numeral system of base d ( 2 ≤ s , d ≤ 16 ). Write a program that shows the binary representation of given 16 -bit signed integer number (the C# type short ). * Write a program that shows the internal binary representation of given 32 -bit signed floating-point number in IEEE 754 format (the C# type float ). Example: -27,25  sign = 1 , exponent = 10000011 , mantissa = 10110100000000000000000 .

Editor's Notes

  • #3: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #4: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #5: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #7: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #8: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #9: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #10: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #11: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #12: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #13: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #15: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #16: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #17: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #18: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #19: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #21: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #22: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #23: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #26: (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##