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

A 75 force is applied to the side of a crate resting on a level floor. The crate has a mass of 25kg. If the coefficient of static friction is .15, is the 75 N f
which term better describes political parties in american politics: division or unifying?
What is larger 0.6 or 3/4 explain?
A spinner is divided into 16 sections.3 sections are red 6 are blue 5 are purple and 2 are orange. If you spin the spinner what is the probability that you will
this gas makes up close to one fourth of the air surrounding earth
how to solve 0.01x+0.07y=0.22 and 0.03x-0.05y=0.14 by substitution
how to solve 0.01x+0.07y=0.22 and 0.03x-0.05y=0.14 by substitution
one meter is approximately equal to 39.39 inches. about how many inches are in 5 meter
what is the equation of a line in slope-intercept form with a slope of -3/4 and a y-intercept of -2
Convert 35kg to its equivalent in g using dimensional analysis