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

Which landmark has a small apartment at the top where its designer would often entertain guests? big ben.
7) Which answer choice correctly completes the sequence of events surrounding President Clinton and the Whitewater scandal? A) Clinton testified before Congress
In the process of ————. DNA is used as a template for making another type of Nucleic acid?
When do you need to use the present subjunctive in Spanish?
helppppppp I dont take links
Fine The Gradient of the curve xy=6, at point 1 & 6.[tex] \\ \\ \\ \\ \\ \\ \\ [/tex]Thnx ~~​
Based on paragraph 3 ("in a different. . . Augustine"), what can most reasonably be inferred about augustine?
if log7=a and log… help me solve ths math problem on picture
There should be 2 answers
Which of these organisms has a sac body plan, and radially symmetry?