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 Glorious Revolution was a
Choose all that apply please. WILL MARK THE BRAINLIEST
Nacy is saving 2 bucks from her allowance every week marco is saving 1 the frist week 2 teh second week 3 teh third week and so on at the end of ten weeks who g
Help asap pls uwu1 : Which is an example of a run-on?A: Until the nineteenth century, travelers and their wheeled wagons could move at about six miles per hour.
What is the relationship between organizational culture and estimating? estimating and culture are independent. culture determines whether estimates are made. c
Which presidents were assassinated?
Look at the following rectangle.Find a binomial expression for the width of the rectangle in terms of x. Justify your answer based on the expressions for the re
What do vascular plants use to grow new plants?​
find the surface area of a rectangular prism having dimension 3 feet x 4 feet x 5 feet?
PLEASE HELP: 97 POINTS + BRAINLIEST Chuck drops a rock from a height of 70 m. How long will it take the rock to hit the ground? Use the formula h(t)=−4.9t^2+v0t