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
PLEASE HELP ME ITS ALGEBRA THANK YOUUUU
vampirchik [111]

Answer: 2,208$

Step-by-step explanation:

To solve this problem, simply determine how much each attendee costs by doing 960$/30attendees = 32$/attendee.  Then, simply multiply this number by 69 to get: 2,208$

Hope it helps :) and let me know if you want me to elaborate further.

3 0
3 years ago
If f(x)=2x and g(x)=1/x what is the domain of (f•g)(x)
Leona [35]

Answer:g(x) is the domain...

Step-by-step explanation:

I don't say u must have to mark my ans as brainliest but if it has really helped u plz don't forget to thnk me...

3 0
3 years ago
Read 2 more answers
Sharon pays $98.75 for twenty-five 14-ounce boxes of Yummy flakes cereal. How much does on box of cereal cost
Viefleur [7K]

Answer:

$3.95

Step-by-step explanation:

5 0
3 years ago
Read 2 more answers
Please help! If you do you will get 'Brainliest'
aalyn [17]

Answer:

B

Step-by-step explanation:

This is because 1/2 down from 1 1/2 is 1 then go 2 down on the number lone and you get 1 (B)

5 0
3 years ago
Read 2 more answers
PLEASE HELP!!!! <br> 100 ÷ 25 • 20 + 4 ÷ 2 – 14
Zolol [24]

The answer is 38

Hope this helps : )

3 0
4 years ago
Read 2 more answers
Other questions:
  • What is 1.9384 to the nearest tenth, hundreth, and thousandth?
    11·1 answer
  • If the total area of a dartboard is 40,000 mm2 and the area of the second ring is 17,500 mm2, what is the probability of landing
    6·2 answers
  • In the chart below shade each day that Ned will swim,circle each day Ned will bicycle
    15·1 answer
  • Why is Write an Equation a good strategy for solving this problem?
    12·1 answer
  • Need help Asap 5 mins please!<br>use the net to find the lateral area of the prisim
    11·2 answers
  • A television is advertised for K2000 cash or on terms of 10% deposit and K80 per month for 3
    8·1 answer
  • Determine the slope-intercept equation of a line with a slope of 3/2 that passes through (2, -1).
    14·1 answer
  • Which is greater 0.35. Or 2/5
    9·2 answers
  • What are the coordinates of the image of vertex G after
    13·1 answer
  • 1/2 (x + 4) = 1/2x + 1
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!