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
Drag the numbers to order them from least to greatest.<br><br> free 25 points
Whitepunk [10]

Answer:

All of them

Step-by-step explanation:

if you divide 24 by 8 the you would get 3 and if you divide 24 by 4 them you will get 6 and if you divide 24 by 3 you will get 8

8 0
3 years ago
Read 2 more answers
thisss guyyy iss looooking fine . but why so serioussss hahahaha. when guysss be looking at you like this. does it make you blus
Elza [17]

Answer:

no- it doesnt make me blush- and uh- i look at them and then away- and then start to draw or read-0-0

Step-by-step explanation:

5 0
3 years ago
A local restaurant is offering a special deal in which customers can receive one appetizer, one entree, and one dessert for a fi
Dmitriy789 [7]
There are105 different choices.
For 1 appetizer, there are 15 different combinations of entrees and desserts. 1 dessert has 5 entrees you can mix, and since there are 3 desserts, there are 15 choices. It goes the same for every appetizer until there is 7x15. 7Ax15choices equals 105 options.
The customer has 105 meal choices.
5 0
3 years ago
What kind of number is negative 18/9
pshichka [43]
I think a non- integer rational number but I’m not real sure on that.
8 0
3 years ago
Select the correct answer. If the function 5x + y = 1 has the domain (-2, 1, 6), then what is the corresponding range? OA. {-9,
Leokris [45]

Answer:

D) {11,-4,-29}

Step-by-step explanation:

rewrite the equation as y= -5x+1 and plug in -2,1 and 6 to get y

-5*-2+1=11

-5*1+1=-4

-5*6+1=-29

3 0
3 years ago
Other questions:
  • How to multiply 11*121
    14·1 answer
  • What is the rate of change of the function?
    10·2 answers
  • There are 33.8 fluid ounces in a liter. There are 128 fluid ounces in a gallon. How many liters per gallon ( Hint: find the unit
    8·2 answers
  • Choose the Algebraic equation that matches the table
    5·1 answer
  • What is the equation of this graphed line?
    7·2 answers
  • Y=4x(8-x). Linear or nonlinear? explain.
    9·2 answers
  • Shelia's measured glucose level one hour after a sugary drink varies according to the normal distribution with μ = 132 mg/dL and
    5·1 answer
  • i need help with this one Eight cookies cost $12. At this rate, how much will 10 cookies cost? soory i didnt see the answer
    8·1 answer
  • Use the given information to determine the exact trigonometric value.
    10·1 answer
  • Jared started a new job. On the first day he had orientation and worked for 2 hours. On the second day he trained for 4 hours. A
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!