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
The circumference of a circular garden is 97.34 feet what is the radius of the garden
Natali [406]

Answer:

15.49

Step-by-step explanation:

circumference= 2πr

:. 97.34= 2πr

r=97.34 ÷2π

r = 15.49

7 0
3 years ago
Read 2 more answers
Help meeeee plsss I will mark brainliest
sergeinik [125]
Using iready the tutorial does not count as a grade and if your worried about passing the test turn your wifi off count to 10 then click the answer you think is right, if it is right turn wifi back on and click next, if wrong click next and it will kick you out of it then turn wifi back on and go back onto the lesson and repeat until you have the right answer, I always got 100% on my quizs this way
3 0
3 years ago
Easy 5th grade math help me :>
mariarad [96]

Answer:

52

Step-by-step explanation:

3 0
3 years ago
Read 2 more answers
Find the mean ,median, and mode round to the nearest tenth if necessary for 9.3, 8.4, 8.0, 9.1, 9.4, 9.0, 7.8, 9.3, 8.0
Ivenika [448]
Mean-1.6
median-9.0
mode-8.65    8.0 and 9.3=17.3/2 is 8.65
8 0
4 years ago
**PLEASE HELP ASAP** Terri is analyzing a circle, y^2 + x^2 = 36, and a linear function g(x). Will they intersect?
Alborosie
We analyze the linear function to find that it has equation y=x.  Drawing the line, we find that it will intersect the circle at negative and positive x-coordinates.

We can prove this by substituting y=x into the given equation:

x^2+x^2=36

2x^2=36

x^2 = 18

x = \pm 3\sqrt{2}

Hence, x = 3\sqrt{2} or -\sqrt{2}, so there are both positive and negative values for x.
5 0
3 years ago
Other questions:
  • THE TABLE SHOWS THE AGES OF THE SWIMMERS ON DION'S SWIM TEAM.THE MEAN AGE OF THE SWIMMERS IS 10.WHAT DOES THE MEAN REPRESENT
    9·2 answers
  • What is the slope of this line?<br> Enter your answer as a fraction in the simplest term in the box.
    9·1 answer
  • duuuudes need help asap FAST lil' sister cant fail;A rectangular horseshoe pit is 53 inches long and 32 inches wide. What is the
    15·2 answers
  • Order the numbers from least to greatest 1.25,-1/8,-0.25,1 1/3
    15·1 answer
  • Is 7/20 and 0.07 equivalent numbers
    12·2 answers
  • Question 1
    6·1 answer
  • If (a,-7) is the solution to the equation 8a=-3b-5, what is a?
    8·1 answer
  • Is this a function ?
    12·1 answer
  • How to solve 3.6 x 2.1? Please tell me step-by-step. Thank you!
    5·1 answer
  • Please help, its Geometry
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!