frozengirl309 frozengirl309
  • 03-07-2019
  • Computers and Technology
contestada

Give a recursive (or non-recursive) algorithm to compute the product of two positive integers, m and n, using only addition and subtraction ?

Respuesta :

SerenaBochenek SerenaBochenek
  • 14-07-2019

Answer:

Multiply(m,n)

1. Initialize product=0.

2. for i=1 to n

3.      product = product +m.

4. Output product.

Explanation:

Here we take the variable "product" to store the result m×n. And in this algorithm we find m×n by adding m, n times.

Answer Link

Otras preguntas

"can you identify the types of cell in which each organelle is found?"
According to an image the typical floor plan for Christian basilica is similar to
Solve for Y please!!!
True or false: student loans often don't require you to start paying them back until after you've completed the course(s). a.true b.false
When a country that imports shoes imposes a tariff on shoes, buyers of shoes in that country become worse off. a. true b. false?
Which part of a classical program gives background information on the musicians?
What features did the british and dutch east india companies share?
Find the volume of the prism. 1,728 cu. in. 864 cu. in. 288 cu. in.
What happened to America's standard of living
One contribution of schooling to the socialization process