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

Calculate the number of moles of chlorine gas needed to form 14 moles of iron (iii) chloride
What happened to Ngo Dinh Diem and his brother Nhu? They were exiled after a military coup. They were killed in a military coup. They were imprisoned in Saigon
Wake up cereal comes in 2 types, crispy and crunchy. If researcher has 10 boxes of each, how many ways can this be done?
The use of ladybugs and praying mantises to consume insect pests in gardens is an example of
Select true or false: if the ph of pure water is 7.0, the hydroxide ion concentration in pure water is 1 × 10–7 m.
What is the answer for this express
Why did scholars and the general public alike refuse to accept Copernicus’s heliocentric model? HELPP
What is the value of x3 + 4, when x = 6?
A typical american family uses 1000 kwh of electricity a month. what is the average rrns current in the 120 v power line to a typical house?
Help me Asap Asap!!!