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 light-year measures the _______ that light travels in 1 year.
The term _______ can be defined as a signal that is continuous over a period of time as opposed to digital, which is a non-continuous signal. analog digital dig
Where in real life do people use parabolas? *apart from maths classrooms and mathematicians.
A football team had 50 players at the start of the season but then some players left the team. After that the team had 42 players. Write a mathematical sentence
what tells the number of protons in the nucleus of every atom of an element
why is potassium iodine electronically neutral
can the ratio of a parent's age to his or her child's age ever be exactly 3:2
kendall was able to score 368 points on 32 games. create a unit rate for this information.
The virus reproduces using the host cell, which ultimately makes
How can you solve problems involving percents