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
Mark can clean his father's office in 30 minutes. His younger sister Lynn can clean the office in 40 minutes. How long will it t
zhannawk [14.2K]
If they each do half, it will take 35 minutes.
7 0
3 years ago
Read 2 more answers
Can you help me find the answer to -1/3+-7/4
Wittaler [7]

Answer:

2.08333333333

Step-by-step explanation:

fromm google

can I have brainliest

8 0
3 years ago
Read 2 more answers
Find each trig ratio
Elena L [17]

Answer:

Step-by-step explanation:

7 0
3 years ago
If your salary is $42,500 and your federal income taxes are 10% of your salary, how much money will you owe this year in federal
DiKsa [7]
42,500 X 0.10 = $4250.
You owe $4250!!
3 0
3 years ago
Read 2 more answers
If the area of the larger circle is 25 times the area of the smaller circle, then the radius of the larger circle is how many ti
IrinaVladis [17]

Answer:

easy peasy (again)

Step-by-step explanation:

given is that, area of the larger one is 25 times more than the smaller one

so, just put it in the area formula,

let the radius of the larger circle be represented by = R

and of the smaller circle be = r

then, (pi) (R)^2 =25 x (pi) (r)^2

=> dividing the equation by pi on both sides, also taking square root on both sides

=> R = 25 r

that would be the radius of the larger circle is 25 times bigger than the smaller radius

(all u need is to pay attention to the data given in the question and the relation between all that data itself) then it'll look like magic of how the question gets solved...the answer is always in front of you, only thing is to look harder ...good luck with what you are aiming to achieve

3 0
3 years ago
Other questions:
  • An item is regularly priced at $21 It is now priced at a discount of %35 off the regular price. Use the ALEKS calculator to find
    14·1 answer
  • Carpet is sold in square yards. How much carpet would a person need to buy for a rectangular room that has dimensions of 10 yard
    13·1 answer
  • An art teacher uses 1 quart of blue paint each month. In one year how many gallons of paint will she use
    9·1 answer
  • Cindy has a picture that is 3 inches wide and 4 inches long. She wants to enlarge it so that it is 12 inches long how wide will
    11·2 answers
  • What is 8 3/4% expressed as a fraction
    7·2 answers
  • In how many ways can 9 hearts be chosen if 12 cards are chosen from a well-shuffled deck of 52 playing cards? a) 715 b) 220 c) 1
    12·1 answer
  • Valentina made costume crowns for the king and the prince in her school play. She used 5 red gems and 8 purple gems for the king
    15·2 answers
  • Barry and Leila decided to have a contest to find who could read more per week. Barry read for hours and Leila read for hours. H
    5·1 answer
  • PLEASE HELP ASAP<br> I'LL MARK BRAINIEST
    12·2 answers
  • Find the equation of a line that passes through the points (-2,-3) and (4,1)
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!