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

Explain mood in poems
Jasmine needs 300cm of fabric to make her new dress. The fabric costs $5 for each METER. How much will her fabric cost to make?​
The price of tomatoes is 1.8 lb/$. How many $ would you need to buy 8.1 lb?​
In the English and Spanish Glossary, the second word in the definition of cartography is
What are the 2 types of Digital Imagery?
What is the difference between each starred example? Why is it called citing your source?
3. (02.01) Solve for x: 3(x + 1) = -2(x - 1) - 4. (1 point) 1 -1 -5 -25 i’m so confused someone pls help
What makes atoms and molecules stable or unstable? O the size of the nucleus O the number of electrons O If the outer energy level is full O if it contains neut
What is the value of (10 – 6)2 + 6 • 2 – (3 + 2)2? A. 10 B. 3 C. –1 D. –5
9–5(x+4)=3(2–x) help!!!!!1