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]
2 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]2 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
Simplify the expression. (1423 – 2x2 + 3x – 7) – (328 + 142 – 10)
Lubov Fominskaja [6]

Answer:

-2x^2+3x+956

Step-by-step explanation:

If you want to do math easier, just look up symbolab.com and it will show you the right answers and how to do the problems.

3 0
2 years ago
Is 1/7 greater than -5​
Montano1993 [528]

Answer:

no

Step-by-step explanation:

1/7 is positive, -5 is negative. Negative is less than positive

4 0
3 years ago
Read 2 more answers
The isotope cobalt-60 has a nuclear mass of 59.933820 u
Anit [1.1K]

To start this question, we should know what is the atomic number of cobalt. The atomic number (the number of protons) of Cobalt is Z =27.

Now, we know that a Cobalt 60 isotope means an isotope of Cobalt whose Atomic Mass is 60.

Thus, in a Cobalt 60 isotope, the number of neutrons in the nucleus are

60-Z=60-27=33

From the question we know that the given nuclear mass is 59.933820 u.

Now, the mass defect of Cobalt 60 can be easily calculated by adding the masses of the protons and the neutrons as per our calculations and subtracting the given nuclear mass from it.

Thus,

Mass Defect = (Number of Protons Mass of Proton given in the question) + (Number of Neutrons Mass of Neutron given in the question)-59.933820 u

\therefore 27\times 1.007825+33\times 1.008665-59.933820=0.5634 u

Thus, the required Mass Defect is 0.5634u.

In eV, the Mass Defect is 931.5MeV\times 0.5634=534.807 MeV

6 0
3 years ago
Read 2 more answers
Jasmine created a scale drawing of her room. She used a scale of 1 in:3 feet. The drawing is 8 inches long by 6 inches wide. Wha
sergiy2304 [10]

Answer:

The area of the room is 432 square feet

Step-by-step explanation:

Let us use the ratio method to solve the question

∵ The scale drawing of the room is 1 inch: 3 feet

→ That means each 1 inch in the drawing represents 3 feet in real

∵ The drawing is 8 inches long by 6 inches wide

∴ The drawing length of the room = 8 inches

∴ The drawing width of the room = 6 inches

→ By using the ratio method

→  inches  :  feet

→  1            :  3

→  8           :  L

→  6           :  W

→ By using the cross multiplication

∵ 1 × L = 8 × 3

∴ L = 24

∴ The actual length of the room is 24 feet

∵ 1 × W = 6 × 3

∴ W = 18

∴ The actual width of the room is 18 feet

Use the formula of the area of the rectangle to find the area of the room

∵ Area of rectangle = length × width

∴ Area of the room = 24 × 18

∴ Area of the room = 432 feet²

∴ The area of the room is 432 square feet

8 0
2 years ago
A tip employee’s earnings most closely resemble those of which?
kotegsom [21]
A tip employee's earnings most closely resemble: a. an employee working on straight commission The amount that the employee get in a tip method will be highly depended on the performance and the satisfaction of services that the employees give to the customer. The better the performance, the more tip that employee will get from the customers
3 0
3 years ago
Read 2 more answers
Other questions:
  • Please help me!!! :(
    13·2 answers
  • I need help for this one do I add them up and equal them to 180?
    14·1 answer
  • Divide 36 by the difference of 16 and 4
    6·2 answers
  • 2/3 of the product of 3/8 and 16
    5·1 answer
  • Can someone please explain how to do these two problems?
    14·1 answer
  • Lou's Diner spent $12.80 on 8 pounds
    5·2 answers
  • 4 men and 6 woman can complete a work in 8 days. while 3 men and 7 woman can complete it in 10 days. in how many days will 10 wo
    11·1 answer
  • Solve x - 6.3 = 4.1 for x
    11·2 answers
  • someone please please help me!
    11·1 answer
  • Solve the equation, enter the value in the box below.<br> 1 x= 5
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!