710 words - 3 pages

Name: ________________________________ Grade: __________

Title: Converting decimal numbers to binary

OBJECTIVES

In this lab, you will develop an algorithm to convert decimal numbers to binary numbers. Then, apply the algorithm to several decimal numbers to obtain their binary equivalent.

II. PROCEDURE

To convert a decimal number to its equivalent binary number, use the following procedure.

Divide the decimal number by two and record the quotient and remainder, R. The quotient obtained is the next number to be divided by two. The remainder is the value of the binary digit for that position. Continue the division until the answer is 0 with a remainder of 1. The remainder is the most significant bit of the binary conversion.

The procedure below demonstrates how to convert the decimal number 12 to its four bit binary equivalent.

12 / 2 = 6 R 0 LSB

All of that equals 8/4/2/1. So when you multiply those numbers by the corresponding four bit numbers you end up with 8/4/2/1 and then if you add that up you get 8+4+2+1= 15.

3. Extend the process described above and convert the following decimal numbers to their eight bit binary equivalent. Record your results.

a. 128 = 1000 0000

b. 250 = 1111 1010

4. What is the largest decimal number that can be generated in eight binary bits? How did you arrive at this result? 255, I arrived at this result by using the code 1111 1111 and using the conversion of 2 to the power of 7 and then 2 to the power of 6 and then 2 to the power of 5 and then 2 to the power of 4 and then 2 to the power of 3 and then 2 to the power of 2 and then 2 to the power of 1 and then 2 to the power of 0, which would all equal 128/64/32/16/8/4/2/1. So, then if you multiply those numbers by the corresponding eight bit numbers, they would equal 128/64/32/16/4/2/1 and lastly if you add all those numbers 128+64+32+16+4+2+1= 255.

5. Describe in your own words the process of converting a decimal number into its binary equivalent. This is the algorithm for converting a decimal number to its binary equivalent. In order to convert the decimal number into a corresponding binary equivalent, you would take the decimal number and divide it by two, if it divides evenly then the remainder being 0 is your far right number in your binary code. Next you take the answer to the last equation and divide by two again, if it divides evenly then again you end up with a remainder of 0 and that is the next number to the left for your binary code. So far it would then read as such; 00. You then divide the answer of that number by 2 again and if you end up with a remainder of 1 then that is your third number to the left. Lastly you take that number and again divide by 2 and again if you have a remainder of 1 then that is your last number in your binary code and it will be the far left number. So the code would look like such, 1100.

6. Rename your iLab document to FiLastNameLab1-2.docx. Upload the completed lab to the weekly iLab Dropbox.

[pic][pic]

Beat writer's block and start your paper with the best examples