Fall 2000 |
Lab 2 Pre-Lab: Base conversion |
CS61C |
Purpose:
Lab policy:
Task: base converter
There are some examples of base conversion between binary and decimal numbers.
Of course there are many other ways of doing the base conversion.
Follow this example and practice on other bases.
(1) 14_base10 to base 2 14_base10 = 2*7 + 0 ( notice remainder = 0 ) 7_base10 = 2*3 + 1 ( notice remainder = 1 ) 3_base10 = 2*1 + 1 ( notice remainder = 1 ) 1_base10 = 2*0 + 1 ( notice remainder = 1 ) now write the remainders down and we have: 14_base10 = 1110_base2
(2) 1110_base2 to base 10 1110_base2 = 1*2^3 + 1*2^2 + 1*2^1 + 0*2^0 = 8_base10 + 4_base10 + 2_base10 + 0_base10 = 14_base10Now practice the following on your own:
Hints:
Feedback:
created: 9/4/00 by Lan *^_^*