A and B are binary numbers. They have been inputted as strings. function add(A, B): while B
Fantastic news! We've Found the answer you've been seeking!
Question:
A and B are binary numbers. They have been inputted as strings.
function add(A, B):
while B is greater than 0:
U = A XOR B
V = A AND B
A = U
B = V * 2
return A
The above is an algorithm to add two non-negative integers A and B.n
Given the initial values of A and B write an efficient C++ program to find out the number of times the while loop of the algorithm is repeated.
Related Book For
University Physics with Modern Physics
ISBN: 978-0321696861
13th edition
Authors: Hugh D. Young, Roger A. Freedman, A. Lewis Ford
Posted Date: