Question

In: Computer Science

Perform double dabble on the following binary (base 2) numbers: Please show your work for full...

Perform double dabble on the following binary (base 2) numbers: Please show your work for full credit. Either digital or hand written is fine.

1. 10011010010

2. 101010

3. 100111010

4. 10101001101

5. 1100100000

For 10pt extra credit - write a program that implements the double dabble algorithm.

Solutions

Expert Solution

Answer

Steps for double dabble

1) Write the given binary number.

2) Starting from the left, double the previous total and add to the current digit.

3) Double your current total and add the next leftmost digit.

4) Continue doubling the current total until the digit end reaches

1) 10011010010 = 1234

solution

0 x 2+1=1

1 x 2+0=2

2 x 2+0=4

4 x 2+1=9

9 x 2+1=19

19 x 2+0=38

38 x 2+1=77

77 x 2+0=154

154 x 2+0=308

308 x 2+1=617

617 x 2+0=1234

2) 101010= 42

solution

0 x 2+1=1

1 x 2+0=2

2 x 2+1=5

5 x 2+0=10

10 x 2+1=21

21 x 2+0=42

3) 100111010 = 314

solution

   0 x 2+1=1

1 x 2+0=2

2 x 2+0=4

4 x 2+1=9

9 x 2+1=19

19 x 2+0=39

38 x 2+1=78

77 x 2+0=157

157 x 2 +0 =314

4) 10101001101 = 1357

solution

0 x 2+1=1

1 x 2+0=2

2 x 2+1=5

5 x 2+0=10

10 x 2+1=21

21 x 2+0=42

42 x 2+0=84

84 x 2+1=169

169 x 2+1=339

339 x 2+0=678

678 x 2+1=1357

Code for double dabble in python

note:- Please check the spacing before executing

#function for doubledabble
def doubledabble(bin):
#initilaizing the sum
sum=0
#loop for iterating through the binary digit
for i in bin:
#calculating the sum
sum=(sum*2)+int(i);
#printing the result
print("The decimal digit is:- ",sum)
#main code which take input from user
bin=input("Enter the binary digit\n")
#calling the function
doubledabble(bin)

Screenshots

Input\output

  


Related Solutions

6. Convert numbers as requested. SHOW YOUR WORK Convert 2B7 (base 16) to binary. Convert 0B2C...
6. Convert numbers as requested. SHOW YOUR WORK Convert 2B7 (base 16) to binary. Convert 0B2C (base 16) to binary. Convert -47 (base 10) to binary 8-bit signed-magnitude. Convert -52 (base 10) to binary 8-bit signed-magnitude. Convert -47 (base 10) to binary 8-bit one's complement. Convert -52 (base 10) to binary 8-bit one's complement. Convert -39 (base 10) to 8-bit binary using excess 127 notation. Convert -61 (base 10) to 8-bit binary using excess 127 notation.
represent the decimal number 101 and 6 as floating point binary numbers please show your work...
represent the decimal number 101 and 6 as floating point binary numbers please show your work and explained, I have a test.
Convert the following numbers to 32-bit, 2s compliment binary and hexadecimal formats. Show your work in...
Convert the following numbers to 32-bit, 2s compliment binary and hexadecimal formats. Show your work in recursive division form. 899726616 1656906428 -77102817 -251026154
For the following operations: write the operands as 2's complement binary numbers then perform the addition...
For the following operations: write the operands as 2's complement binary numbers then perform the addition or subtraction operation shown. Show all work in binary operating on 8-bit numbers. 7 + 3 7 - 3 3 - 7
Binary and Floating point: Convert −98765.4321 to IEEE 745 both single and double (show your work)
Binary and Floating point: Convert −98765.4321 to IEEE 745 both single and double (show your work)
Convert the hexadecimal number BAD D00D 60E5 F00l to binary, octal, base-4. Show your work.
Convert the hexadecimal number BAD D00D 60E5 F00l to binary, octal, base-4. Show your work.
1. Convert to binary and hexadecimal (PLEASE SHOW WORK) a. 35 - binary: - hexadecimal: b....
1. Convert to binary and hexadecimal (PLEASE SHOW WORK) a. 35 - binary: - hexadecimal: b. 85 - binary: - hexadecimal: c. 128 - binary: - hexadecimal: d. 4563 - binary: - hexadecimal:
Please show all work for full credit! When performing calculations, round numbers to 3 decimal places...
Please show all work for full credit! When performing calculations, round numbers to 3 decimal places The California Condor (Gymnogyps californianus) is a critically endangered species. In 1991, 48 adults individuals were released in the wild from the captive breeding program. In 2016, there were approximately 323 individuals in existence. 1.Calculate r for this time frame, assuming a continuous and constant growth rate (2 pts). 2.What is the doubling time of this population (2 pts)? 3. 30 rabbits are introduced...
Convert from hexadecimal to binary to decimal (PLEASE SHOW WORK) 1. B2 - binary: - decimal:...
Convert from hexadecimal to binary to decimal (PLEASE SHOW WORK) 1. B2 - binary: - decimal: 2. 37 - binary: - decimal: 3. 0A -binary: - decimal: 4. 11 - binary: - decimal:
Please show all work: Determine the 2’s complement equivalent of the following numbers in 8-bit format...
Please show all work: Determine the 2’s complement equivalent of the following numbers in 8-bit format (N.B: You must show your work for full credit)! -12 = -9 =
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT