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

What types of individuals in a population are represented by the two ends of a bell curve ?
Why is a globe more accurate than a flat projection map?
It looks like the choir director is more interested in her than me.
The product of 4 and the sum of a number and 12 is at most 16
1. Why was the government of ancient Athens called a direct democracy?
The "A" in ACL stands for
Which state applied to join the Union in 1819?
Which of the following is inaccurate in relation to viruses? a. They feature a capsid. b. They seek a specific host. c. They have nucleic acid core. d. They rep
How atoms and molecules are important to cell processes?
Sandy has several pictures of to hold lemonade for the school bake sale two pictures can hold 64 ounces each and four pictures can hold 48 ounces each how many