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

Match the vocabulary with the correct definition. Question 1 options: judges are elected; court is responsible for Civil and Criminal cases and ALL felony cases
What was the only type of life on planet for hundreds of millions of years?
What is the strength of "the governor versus the legislature"?
The earliest elephants evolved during the: Paleocene Eocene Oligocene Holocene
in a first aid kit the ratio of large bandages to small bandages is 5 to 2. Based on this ratio, how many large bandages are in the kit if there are total of 60
Why is cellular reproduction important for homeostasis? It helps cells make oxygen. It helps cells make glucose. It removes waste from cells. It splits a ce
Find the area of the shaded region?
When reading my ántonia from a feminist perspective, which will readers most likely pay attention to?
The sources of american criminal procedure law include:
What’s the greatest common factor for 36^3 and 8x