Question: Use simple C++. (a) Describe an algorithm for multiplying positive integers which uses the distributive property. x y = x (1 + 1 + .
Use simple C++. (a) Describe an algorithm for multiplying positive integers which uses the distributive property.
x y = x (1 + 1 + . . . + 1) = x + x + . . . + x
So x y is the sum of y xs.
INPUT: Positive integers x and y.
OUTPUT: Their product xy
(b) When performing the algorithm above with x = 123 and y = 6, how many sums are computed?
(c) In general, how many sums are computed for input x and y?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
