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
Given h(x)=(3x-4), f(x)=(-7x+2), g(x)=(9x+1), which of the following is equivalent to 2x+3?
melomori [17]

Answer: g(x)=(9x+1)

Step by step explanation:

7 0
3 years ago
Evaluate P(5, 3). 15 20 60
insens350 [35]

Answer:

20.

Step-by-step explanation:

P(5,3)  = 5! / 3!

= (5*4*3*2*1) / (3*2*1)

= 20.

7 0
3 years ago
Rewrite the equation y=2|x−3|+5 as two linear functions f and g with restricted domains.
vesna_86 [32]

The absolute value transforms a negative number into a positive number.

For example

Let z be a real number, then:

| z | It will always be a positive number.

This means that:

If z is a negative number, then:

| z | = -z

If z is a positive number, then:

| z | = z

This means that for the expression the expression y = 2 | x-3 | +5

When x-3 > 0 then:

| x-3 | = x-3

When x-3 < 0 then:

| x-3 | = - (x-3)

Then we can divide the expression into two functions f (x) and g (x).

f (x) = 2 (x-3) +5

f (x) = 2x-6 + 5

f (x) = 2x-1

For

(x-3) \geq 0\\ x \geq 3


g (x) = 2 (-x + 3) +5

g (x) = -2x + 6 + 5

g (x) -2x +11

For

(x-3) < 0

x < 3

8 0
3 years ago
X³+2x²-15x, x²-7x+12 and 3x²-27 find h.c.f​
RideAnS [48]

Answer:

{x}^{3}  + 2 {x}^{2}  - 15x \\ x( {x}^{2}  + 2x - 15) \\ x( {x}^{2}  + 5x - 3x - 15) \\ x(x(x + 5) - 3(x + 5) \\ x((x + 5)(x - 3)) \\  {x}^{2}  -7x + -  12 \\  {x}^{2}  - 4x + 3x - 12 \\ x(x - 4) + 3(x - 4) \\ (x  - 4)(x + 3) \\ 3 {x}^{2}  - 27 \\ 3( {x}^{2}  - 9) \\ 3((x + 3)(x - 3)) \\  \\ the \: hcf \:  = (x + 3)

6 0
2 years ago
Please help asap 30 pts
cluponka [151]

Remark

You need a split statement like C or D. A and B would have to be considered if the ages were between 12 and 60.  However the discounts apply the other way. Up to 12 and over 60. You need two inequalities to describe this.

<em><u>Under 12</u></em>

x ≤ 12

The pointy end of the arrow points toward the x. x must be less than or at most equal to 12. The pointy end of the inequality must be directed towards the smaller number.

<em><u>Over 60</u></em>

x ≥  60

This time the pointy end is directed towards the 60. x must be at least 60 and then upwards.

So C is the correct answer.

4 0
3 years ago
Other questions:
  • How to simplify 333/1000
    13·1 answer
  • Solve the equation without the use of a calculator. please Help!!! Thank you!!!<br> 12x^3-30x=8-2x^2
    7·1 answer
  • Is 2.9 grater than 2.90
    15·2 answers
  • G(n)= 3n+5 h(n)= 4n-5 Find (g•h)(n)
    5·1 answer
  • which unit of measure would be the most appropriate to measure the capacity of a bottle of nail polish?
    15·1 answer
  • Can someone pleaseeee help if you’re correct I’ll give u brainlist
    14·1 answer
  • What is 5 3/8 as an improper fraction
    10·2 answers
  • 2+2 I<br> dont know how but 4 was wrong guys am I not thinking right?
    14·1 answer
  • The sum of two numbers is 48.<br>the second number is seven times the first number​
    11·2 answers
  • One function has an equation in slope-intercept form: y = x + 5. Another function has an equation in standard form: y + x = 5. E
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!