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

When you see a _____, slow down and pay special attention to conditions around the intersection as you pass through it. A.flashing yellow lights B.flashing red
Name two things brought back from crusades
Can someone help me on this question.
What is software ownership
You pay $2.36 for 6 donuts. What is the unit price
Median AM and CN of △ABC intersect at point O. What part of area of △ABC is the area of △AON?
Which of the following is not a way the nation states interact with one another? A) diplomacy B) legislation C) humanitarian aid D) trade
Which of the following individuals was a founding member of the Sons of Liberty and helped organize the Boston Tea Party? A. Samuel Adams B. George Washin
Which diagram shows a reflection of figure A across the y-axis HELP ASAP PLS
Codes of ethics often differ with respect to three characters. They are: