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

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!