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 is the condition in which two different alleles are expressed equally when inherited ?
Use breaking apart to find the product in multiplication 7x3
What is 0.03703704 as a fraction
what strategic advantage did the thirteen colonies enjoy because of their geographic location?
What are examples of slow land changes
Put these numbers to least to greatest negative 0.9, negative 0.09,negative 0.99!!(Thank you)!!
Are these sentences time, sequence, condition, or state? We will have completed a full week's worth of work in the forest. We will be flying to a remote part of
True or false? By the end of the last ice age, humans began the practice of agriculture.
The epidermal tissue of a plant prevents _________.
Sid wrote 541,309 on his paper. Using words and numbers explain how the number would change if he switched the digits in the hundred thousands and tens place