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
I need help please!!
dalvyx [7]

Answer:

y=1/2x +2

Step-by-step explanation:

1/2 is the slope, 2 is the y intercept.

3 0
3 years ago
HELP ASAP PLS! The ratio of bows to headbands of Monique’s hair accessories is 8:4. Select all true statements.
Ratling [72]
Obviously a b c & d.
3 0
3 years ago
Help please very important
son4ous [18]
Domain is (-10, infinity) and range is negative infinity, positive infinity.
4 0
3 years ago
Which of the following correctly expresses sin (70) + sin(30) as a product?
JulsSmile [24]

Answer:

2sin50 cos20

Step-by-step explanation:

We need to write sin (70) + sin(30) as a product. The formula used here is :

\sin A+\sin B=2\sin (\dfrac{A+B}{2})\cos(\dfrac{a-b}{2})

Here, A = 70 and B = 30

So,

\sin 70+\sin 30=2\sin (\dfrac{70+30}{2})\cos(\dfrac{70-30}{2})\\\\\sin 70+\sin 30=2\sin 50\cos20

So, the value of sin (70) + sin(30) is 2sin50 cos20. Hence, the correct option is  (c).

7 0
3 years ago
Y=--2x<br> And y = x + 3<br> Does the points intersect?
DedPeter [7]

The lines intersect at the point (-1,2)

Explanation:

The given two equations are y=-2x and y=x+3

We need to determine the whether that they intersect.

To determine the point of intersection, let us solve the equation by substitution method.

Let us equate both the equations.

Thus, we have,

-2x=x+3

Subtracting both sides by x, we get,

-2x-x=x+3-x

Simplifying, we have,

-3x=3

Dividing both sides by -3, we get,

x=-1

Substituting x=-1 in the equation y=-2x, we get,

y=-2(-1)

y=2

Thus, the lines intersect at the points x=-1 and y=2

Hence, the lines intersect at the point (-1,2)

5 0
3 years ago
Other questions:
  • What is 0.024mm to m
    12·1 answer
  • X + 2y = 5
    15·2 answers
  • What is formula of sec(A+B)​
    12·1 answer
  • Use the gcf of 48 and 30 to write the sum of the two numbers as the product of their gcf and another sum
    13·1 answer
  • HELP asap<br> the pic saids it all
    9·2 answers
  • Solve the inequality s-12 _&gt; -1
    9·1 answer
  • The term-to-term rule for a different sequence is
    13·1 answer
  • Heres 5 freepoints to the first 2 dedicated people that r stll wake
    8·2 answers
  • Which property is used in the following equation:
    6·1 answer
  • A horse has a water barrel in which 3/10 of a gallon is drank out of it every day. How many days will it take the horse to drink
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!