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

Given the following diagram, which Segments are congruent ?
Question- Rae is 27 inches tall on her first birthday. She grows around 6 inches per year after that. What is the rate of change for the scenario described? An
50 POINTS I don't know if anyone will do this but this is an essay but I will give 50POINTS!! for this so plzz help me. Don't scam plzz
definition of hypothesis
Which statement best describes insoluble substances? Insoluble substances remain the same when in water. Insoluble substances become part of the liquid subst
Evaluate 5x10 -6²+5 A:9 B:19 C:43 D:85
3/5 meters per 9 minutes. What is the unit rate in minutes per meter?
Revolutions are often facilitated by a dissident elite. Who is this group composed of?
The native range of a species includes all areas in which it lives. Please select the best answer from the choices provided OT OF
why heart is placed on the left hand side​