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

what is the main idea of the paragraph. have yo ever wondered how images find there ways onto televisions screen. some tv shows are delivered to homes thro
What is another word for cytosol
OF what kind of organic compound are oils, waxes, and fats an example?
What is the area of a rectangle with vertices at (4, 3), (11, 3), (11, 9), and (4, 9)?
Diastole is: the technical name for a heart attack a form of hypertension when the ventricles relax and fill with blood the contraction of the ventricles
What is the name of the period that has the digits 913,256.
what is a antonym for organelle
How did the mayflower compact affect the settlement of the plymouth colony? a) it set up the process for governing farming in the colony. b) it became the basis
Why has the physical description of the hero changed throughout the years? A. To prove that authors can create original characters B. To allow for the advanceme
A single box of thumb tacks weighed 3 1 ⁄2 ounces. If a teacher had 4 1⁄7 boxes, how much would their combined weight be?