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 structure allows air to flow safely into the lungs after leaving the nasal cavity?
The tissue called phloem has what function in vascular plants?
A patient with a history of cirrhosis tells the nurse that his abdomen seems to be getting larger and that he has gained 9.7 kg (20 lb) in the last 6 months. ho
________ data, or the facts and figures that have already been collected about the coffee collective prior to the research at hand, would include information re
Solve for Y please!!!
Calculate the mass of aluminum in 500 g of Al(C2H3O2)3
Write the slope-intercept form of an equation of the line that passes through (2,-4) and (0,6)
answer 2 questions pls 1)x is how many percent less then 5x? 2)What is 1/6 of 9/2 of 8/5?
Next day his luggage arrived through the slush and very remarkable luggage it was
Which is the best thesis statement for a paper on politics in Brazil that is intended for a beginner audience? A. Brazil’s democracy has many similarities to