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

The expression 6(x − 5) means the -------- If x = 7, the value of the expression is ------- (Blank 1 ) 1. Sum of 6 and the sum of X and 5. 2. Product of 6 and
PLEASE HELPP! Which of the following describes how the circulatory and excretory systems work together to help maintain homeostasis? A.By delivering oxygen to
the sum of two consecutive odd numbers is 44 what is the smallest number​
12w-27=-34+14w whats the answer
what was soviet unions reaction about the pentagon papers?
Can you name another genetic variation among humans that might be an adaptation to the environment? Why do you think it fits the category of adaptation?
How to find volume of 7 and 8? (20 pts)
*10 POINTS* Which variable expression represents the following word phrase? "8 less than the quotient of 6 and a number" Question 1 options: 8−6n 8−n6 6n−8 n6−8
The price of a computer was decreased by 30% to £336. What was the price before the decrease?
When the population of organisms in an environment increases, what inevitably happens to the population growth rate?       A. Continues growing exponentially  B