MEng1052 Introduction to Computer and programming Debrebrhan University

# Meng1052 introduction to computer and programming

This preview shows page 89 - 105 out of 130 pages.

MEng1052 Introduction to Computer and programming Debrebrhan University By:Endrias Haile Positional number system Integers MEng1052 Introduction to Computer and programming Debrebrhan University By:Endrias Haile Positional number system The following shows the place values for the integer +224 in the decimal system. Note that the digit 2 in position 1 has the value 20, but the same digit in position 2 has the value 200. Also note that we normally drop the plus sign, but it is implicit. MEng1052 Introduction to Computer and programming Debrebrhan University By:Endrias Haile Examp le Reals Example 2.3 The following shows the place values for the real number +24.13. Positional number system The binary system (base 2) In this system the base b = 2 and we use only 2 symbols S = {0, 1} The symbols in this system are often referred to as binary digits or bits(binary digit). 8 bits = 1 byte 4 bytes = 1 word (in many systems) MEng1052 Introduction to Computer and programming Debrebrhan University By:Endrias Haile 2. 94 Integers Example The following shows that the number (11001) 2 in binary is the same as 25 in decimal. The subscript 2 shows that the base is 2. Reals Example The following shows that the number (101.11) 2 in binary is equal to the number 5.75 in decimal. Positional number system The hexadecimal system (base 16) In this system the base b = 16 and we use 16 symbols to represent a number. The set of symbol is S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F} Note that the symbols A, B, C, D, E, F are equivalent to 10, 11, 12, 13, 14, and 15 respectively. The symbols in this system are often referred to as hexadecimal digits . MEng1052 Introduction to Computer and programming Debrebrhan University By:Endrias Haile 2. 97 Integers The following shows that the number (2AE)16 in hexadecimal is equivalent to 686 in decimal. Example Positional number system The octal system (base 8) In this system the base b = 8 and we use 8 symbols to represent a number. The set of symbol is S = {0, 1, 2, 3, 4, 5, 6, 7} The symbols in this system are often referred to as octal digits . MEng1052 Introduction to Computer and programming Debrebrhan University By:Endrias Haile 2. 99 Integers Example The following shows that the number (1256) 8 in octal is the same as 686 in decimal. Conversion We need to know how to convert a number in one system to the equivalent number in another system. Since the decimal system is more familiar than the other systems, we first show how to covert from any base to decimal. Then we show how to convert from decimal to any base. Finally, we show how we can easily convert from binary to hexadecimal or octal and vice versa. MEng1052 Introduction to Computer and programming Debrebrhan University By:Endrias Haile Decimal to any base Decimal to any base MEng1052 Introduction to Computer and programming Debrebrhan University By:Endrias Haile Decimal to any base MEng1052 Introduction to Computer and programming Debrebrhan University By:Endrias Haile The following shows how to convert 35 in decimal to binary. We start with the number in decimal, we move to the left while continuously finding the quotients and the remainder of division by 2. The result is 35 = (100011) 2 . Decimal to any base MEng1052 Introduction to Computer and programming Debrebrhan University By:Endrias Haile  #### You've reached the end of your free preview.

Want to read all 130 pages?

• Spring '18
• Endrias
• Binary numeral system, Endrias Haile, Debrebrhan University
• • •  