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

hey can you please help me posted picture of question
The world's largest state in terms of territorial extent is ________.
A family took a trip. They spent $90.71 for gasoline, $153.00 on meals, $197.00 on amusements, and $73.38 on miscellaneous expenses. How much did the trip cost?
Which of these is part of the estate's water system?A. aviaryB. wrestling groundC. bathsD. colonnade
Electricity is the _____ of charged particle
Why did Roger Williams establish a colony in Rhode Island?
The term "reagan democrats" describes voters who shared what characteristics?
Find the area of the triangle. (round to the nearest whole number)
Find the equation of the line. A) y= -3/2 x + 1 B) y= -2/3 x - 1 C) y= 2/3 x + 1 D) y= 3/2 x - 1
How do I do this in an equation?