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

Do the authors content that the denial of women’s rights has been intentional or unintentional?
What is the current population as of this very moment? PLEASE HELP!!!!!
A population of mussels was observed in a particular ecosystem. It was found that crabs preferred these mussels as their favorite food. Few mussels developed a
What Supreme Court decision upheld segregation laws in the United States? A. Roe v. Wade B. Parks v. Birmingham C. Brown v. Board of Education
Qual solo seria facilmente semeado? 1-solo arenoso 2-solo argiloso 3-solo humífero
write a congruence statement for the pair of trangles
Bauer software's current balance sheet shows total common equity of $5,125,000. the company has 650,000 shares of stock outstanding, and they sell at a price of
You are Rachit /Reena living in a hostel. Write a letter to your mother, complaining about the poor quality of food served in the mess especially the lack of ve
More points!! Please answer all questions
Do the authors content that the denial of women’s rights has been intentional or unintentional?