1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
olga nikolaevna [1]
3 years ago
8

Without using a division or multiplication operator and without using iteration , define a recursive method named product that a

ccepts two int parameter , m and k, and calculates and returns the integer product of m times k . you can count on m>=0 and k>=0.
Mathematics
1 answer:
Fantom [35]3 years ago
8 0

I will be using the language C++. Given the problem specification, there are an large variety of solving the problem, ranging from simple addition, to more complicated bit testing and selection. But since the problem isn't exactly high performance or practical, I'll use simple addition. For a recursive function, you need to create a condition that will prevent further recursion, I'll use the condition of multiplying by 0. Also, you need to define what your recursion is.
To wit, consider the following math expression 
 f(m,k) = 0 if m = 0, otherwise f(m-1,k) + k 
 If you calculate f(0,k), you'll get 0 which is exactly what 0 * k is. 
 If you calculate f(1,k), you'll get 0 + k, which is exactly what 1 * k is.   
 So here's the function   
 int product(int m, int k) 
 { 
  if (m == 0) return 0; 
  return product(m-1,k) + k;  
}
You might be interested in
Find the value of x<br><br> A.76<br> B.50<br> C.18<br> D.36
kvasek [131]

Answer: D

Step-by-step explanation:

5 0
3 years ago
The number 3.141592... ic called what?
Flura [38]
Hello!

The never-ending number that you have listed above is known as pi. The symbol for pi is: \pi

I hope this helps answer your question! Have a great day!
6 0
3 years ago
What is the area of the triangular part of the flag below
qaws [65]
The answer is 492 hope it helps
6 0
3 years ago
What is the measure of UVW in the triangle shown? <br><br>A. 140° <br>B. 50° <br>C. 60° <br>D. 10°​
Vilka [71]

Answer:

b

Step-by-step explanation:

40 + 90 =130

180-130=50

4 0
3 years ago
6. What are the zeroes for the<br>function<br>f(x) = 2x3 + 12x – 10x2?<br>​
agasfer [191]

Answer:

<h2>x = 0, x = 5 + √13 and x = 5 - √13.</h2>

Step-by-step explanation:

f(x) = 2x^3 + 12x – 10x^2 can and should be rewritten in descending powers of x:  

f(x) = 2x^3 – 10x^2 + 12x

This, in turn, can be factored into f(x) = x·(x² - 10x + 12).

Setting this last result = to 0 results in f(x) = x·(x² - 10x + 12).

Thus, x = 0 is one root.  Two more roots come from x² - 10x + 12 = 0.

Let's "complete the square" to solve this equation.

Rewrite x² - 10x + 12 = 0  as  x² - 10x +              12 = 0.

a) Identify the coefficient of the x term.  It is -10.

b) take half of this result:  -5

c) square this last result:  (-5)² = 25.

d) Add this 25 to both sides of x² - 10x +              12 = 0:

     x² - 10x +  25      +      12 = 0 + 25

e) rewrite x² - 10x +  25 as the square of a binomial:

       (x - 5)² = 13

f)  taking the sqrt of both sides:  x - 5 = ±√13

g) write out the zeros:  x = 5 + √13 and x = 5 - √13.

The three roots are x = 0, x = 5 + √13 and x = 5 - √13.

8 0
3 years ago
Other questions:
  • Housing expenses are commonly referred to as PITI. What does PITI stand for?
    14·1 answer
  • A bottle contains 3.5 liters of water. A second bottle contains 3,750 milliliter soft water. How many more millimeters are in th
    9·1 answer
  • Right away to compare 200 meters to 4 hours
    8·1 answer
  • The coordinates of Trapezoid EFGH are E(8, 8), F(8,10), G(1, 6), and H(4, 1). The image of EFGH under dilation is E’F’G’H’.
    15·1 answer
  • Write an algebraic expression for the phrase "thirty less than the product of a number y and four".
    10·2 answers
  • By comparing medians which person went to the movies the most per month
    10·1 answer
  • May someone help me pls
    11·1 answer
  • Identify an equation in slope intercept form for the LINE parrelel to y=5x+2 that passes through - 6,-1
    5·1 answer
  • 3800/180 seconds into ratio​
    12·1 answer
  • Please help me P.S ill give brainiest to correct answer
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!