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 cube with 2-inch sides is placed on a cube with 3-inch sides. Then a cube with 1-inch sides is placed on the 2-inch cube. What is the surface area of the thre
What is the answer??
I am desperate! 95 points for correct answer!!!!!1543 pages is $77.40, 7361 pages is $368.30 using a linear equation with $250 in budget how many pages can you
Explain how the quotation below illustrates the immigration policy of President Obama. "For we know that our patchwork heritage is a strength, not a weakness. W
Please please help me
Which is more important, the intention or the act?
Solve the inequality: 3x-3<9 5x+2<32
list the ways you can preserve soft tissue as a fossil
Create your own example of a fallacy: Locate or develop an example of each of the following kinds of false appeals. For each example, explain why you think that
Select the correct answer. Which fallacy does this excerpt from "Cotton Is King" by James Henry Hammond contain? It was this that brought on the American Revolu