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

people may have chosen to become sedentary because _____.
A monopolist's goal is to _____. lose money just cover costs maximize profits
Suppose a bill arrives on the desk of the president of the United States. It originated in the Senate. He decides on a pocket veto. This will be possible for hi
explain ways that organisms interact in helpful and harmful ways
explain ways that organisms interact in helpful and harmful ways
What is twenty hundreds times eight tens
Which of the following was a MAJOR reason why the Anti-Federalists opposed the ratification of the United States Constitution?
The amniotic egg is a characteristic of A. amphibians. B. reptiles. C. birds. D. both b. and c. .
What does the abbreviation misc. Stand for?
is 18 a prime or composite