Question: Program a function binary_add (a,b) that computes the sum of the binary numbers a=(ai1,ai2,,a0)2 and b=(bj1,bj2,,b0)2 using the algorithm discussed in lecture. No credit will

 Program a function binary_add (a,b) that computes the sum of the

Program a function binary_add (a,b) that computes the sum of the binary numbers a=(ai1,ai2,,a0)2 and b=(bj1,bj2,,b0)2 using the algorithm discussed in lecture. No credit will be given to functions that employ any other implementation. The function can not use built-in functions that already perform some kind of binary representation or addition of binary numbers. For example, the function implementation can not use the functions bin() or int (a, base =2). The function should satisfy the following: 1. INPUT: - a - a string of the 0's and l's that make up the first binary number. The string may contain spaces. - b - a string of the O's and 1's that make up the first binary number. The string may contain spaces. 2. OUTPUT: - the string of O's and l's that is the result of computing a+b. The string must be separated by spaces into blocks of 4 characters or less, beginning at the end of the string. EXAMPLE: binary_add( ' 101011,11011) '100 0110

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!