Name:______Visual C++ Worksheet on Number Systems - Read thoroughly

CONVERTING TO BASE 10

Base ten has 10 symbols – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

103 102 101 100 Place Value Thousands Hundreds Tens Ones Numeral 5 2 7 1

Multiply numeral by the place value This number equals five thousand, two hundred, seventy one, 5271

A. FROM BINARY – BASE 2

Base two has 2 symbols – 0 and 1 Multiply numeral by the place value

26 25 24 23 22 21 20 Place Value 64 32 16 8 4 2 1 Numeral 1 0 1 1 0 1 1

Multiply numeral by the place value to get the value in base 10 1 x 64 = 64 0 x 32 = 0 1 x 16 = 16 1 x 8 = 8 0 x 4 = 0 1 x 2 = 2 1 x 1 = 1 ------Then add 9110 base 10 value of 10110112 B. FROM OCTAL – BASE 8

Base eight has 8 symbols – 0, 1, 2, 3, 4, 5, 6, 7 Multiply numeral by the place value

83 82 81 80 Place Value 512 64 8 1 Numeral 3 1 7 4

Multiply numeral by the place value to get the value in base 10 3 x 512 = 1536 1 x 64 = 64 7 x 8 = 56 4 x 1 = 4 ------Then add 166010 base 10 value of 3174 8

C. FROM HEXADECIMAL – BASE 16

Base 16 has 16 symbols– 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Multiply numeral by the place value

163 162 161 160 Place Value 4096 256 16 1 Numeral A 2 F C

Multiply numeral by the place value to get the value in base 10 A x 4096 = 10 x 4096 = 40960 2 x 256 = 512 F x 16 = 15 x 16 = 240 C x 1 = 12 x 1 = 12 ------Then add 4172410 base 10 value of A2FC 16 CONVERTING FROM BASE 10

D. CONVERT 60010 TO BINARY

METHOD 1 – USING DIVIDENDS – DIVIDE BY 2

600/2 =300 r 0 (r is remainder) 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 =1 r 0 1/2= 0 r 1 Read remainders from the bottom up 60010 is 10010110002

Check: 29 28 27 26 25 24 23 22 21 20 Place Value 512 256 128 64 32 16 8 4 2 1 Numeral 1 0 0 1 0 1 1 0 0 0

512 + 64 + 16 + 8 = 600 It checks!

METHOD 2 – USING REMAINDERS – DIVIDE BY PLACE VALUE

29 28 27 26 25 24 23 22 21 20 Place Value 512 256 128 64 32 16 8 4 2 1

Choose largest place value that divides into 600 600/512 = 1 r 88 place a 1 in the 512 column cannot divide 88 by 256 or 128 so place 0s in those columns 88/64 = 1 r 24 place a 1 in the 64 column cannot divide 24 by 32 so put a 0 in the 32 column 24/16 = 1 r 8 put a 1 in the 16 column 8/8 = 1 r 0 put a 1 in the 8 column.

Done – no remainder!

29 28 27 26 25 24 23 22 21 20 Place Value 512 256 128 64 32 16 8 4 2 1 Numeral 1 0 0 1 0 1 1 0 0 0 E. CONVERT 60010 TO OCTAL

METHOD 1 – USING DIVIDENDS – DIVIDE BY 8

600/8 = 75 r 0 (r is remainder) 75/8 = 9 r 3 9/8 = 1 r 1 1/8 = 0 r 1

Read remainders from the bottom up 60010 is 11308

Check: 83 82 81 80 Place Value 512 64 8 1 Numeral 1 1 3 0

(1 x 512) + (1 x 64 ) + (3 x 8) = 512 + 64 + 24 = 600 ! It checks!

METHOD 2 – USING REMAINDERS – DIVIDE BY PLACE VALUE

83 82 81 80 Place Value 512 64 8 1

Choose largest place value that divides into 600 600/512 = 1 r 88 place a 1 in the 512 column 88/64 = 1 r 24 place a 1 in the 64 column 24/8 = 3 r 0 place a 3 in the 8 column. Done – no remainder! F. CONVERT 60010 TO HEXADECIMAL

METHOD 1 – USING DIVIDENDS – DIVIDE BY 16

600/16 = 37 r 8 (r is remainder) 37/16 = 2 r 5 2/16 = 0 r 2 Read remainders from the bottom up 60010 is 25816

Check: 162 161 160 Place Value 256 16 1 2 5 8

(2 x 256) + (5 x 16) + (8 x 1) = 512 + 80 + 8 = 600 It checks!

METHOD 2 – USING REMAINDERS – DIVIDE BY PLACE VALUE

162 161 160 Place Value 256 16 1

Choose largest place value that divides into 600 600/256 = 2 r 88 place a 2 in the 512 column 88/16 = 5 r 8 place a 5 in the 16 column 8/1 = 8 r 0 place a 8 in the 1 column.

Done – no remainder! Name:______Visual C++

Use handout for conversion information. Include all work showing how you did the conversion for full credit.

1. Convert each of the following binary numerals to base 10 a) 1001 ______b) 110010 ______c) 1000000 ______d) 111111111111111 (fifteen 1s) ______

2. Convert each of the following octal numerals to base 10 a) 1238 ______b) 27058 ______c) 100008 ______d) 777778 ______

3. Convert each of the following hexadecimal numerals to base 10 a) 1216 ______b) 1AB16 ______c) ABC16 ______d) FFF16 ______

4. Convert each of the following base 10 numbers a) 5810 to binary ______b) 7510 to octal ______c) 41210 to hexadecimal ______