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

By 1963, which of the following had not been achieved by the Civil Rights Movement? Answer: Winning the free exercise of voting rights
in which country did the original stupa evolve in pavilion-like watchtower? A.China B.India C.Japan
Carry out electrolysis of dilute CuSO4 using copper electrodes. State the products formed at the electrodes and nature of the electrolyte
Order numbers from least to greatest -2.1, -2, 2 1/11, 2.1
what industry inspired a popular nickname for vancouver, canada?
Which justification describes the process? Step 1. 4x + 2= 10 step 2. 4x=8 A. Using the subtraction of property of equality, 2 is subtracted from both sides of
Question 1 (1 point) Which is point (4,-5) on the graph? A 4 X -5-4-3-2-1 1 2 3 4 5 A b c or d
Explain how rifting occurs.
If 15 units represent 90 kilograms what is the value of 6 units
Solve. −1/3(6x−15)+6x>8x−11 x<−1 x>−1 x<4 x>4