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
USPshnik [31]
3 years ago
5

Complete the recursive function raisetopower(). ex: if userbase is 2 and userexponent is 4, then raisedvalue is assigned with 16

(i.e. 2^4). note: this example is for practicing recursion; a non-recursive function, or using the built-in function pow(), would be more common.
Computers and Technology
1 answer:
lesya [120]3 years ago
6 0
Using the property that x^n is x*x^(n-1) you can write a recursive function:

double raisetopower(double x, int n)
{
   if (n <= 0) {
      return 1.0;
   }
   return x*raisetopower(x, n - 1);
}

Note that this crude implementation does not deal with negative or fractional exponents. But it shows recursion.

You might be interested in
6. At age 17, what was Minhaj's definition of the American Dream?
marta [7]
“To me being American means having the opportunity to reach for our goals. It’s accepting where we come from while embracing our dreams and where we’re headed. It’s what makes America great.”
3 0
3 years ago
Quired to the weight
expeople1 [14]

Answer:

The mechanical advantage is 0.25

This mechanical advantage shows that the force at which the deodorant sprays is the quarter of the applied effort, and hence the efficiency of your finger as a machine is 25%.

Explanation:

Given;

output force, F₂ = 15 N

input force, F₁ = 60 N

Mechanical advantage also known as force ratio is defined as the ratio of the output force (load) to the ratio of input force (effort).

M.A = \frac{0utput \ Force}{1nput \ Force} \\\\M.A = \frac{15 \ N}{60 \ N} \\\\M.A = 0.25

This shows that the force at which the deodorant sprays is the quarter of the applied effort, and hence the efficiency of your finger as a machine is 25%.

3 0
2 years ago
Listed items that are not in any particular order should be identified with _____.
NeTakaya

A dictionary or other type of informational book

5 0
3 years ago
Configuring a firewall to ignore all incoming packets that request access to a specific port is known as ____.
Sati [7]

Answer: Logical Point Blocking

Explanation:

4 0
1 year ago
25 points select 3 options!!!!!!!!!!!!!!!!!!!!!!!!!
Veronika [31]

Answer: don't know sorry

Explanation:

5 0
2 years ago
Read 2 more answers
Other questions:
  • You have an insurance policy with a $300 premium and a $500 deductible. How much should you expect to pay the insurance company
    15·1 answer
  • You've formatted the first paragraph of a document. What button can you use to apply the formatting from the first paragraph to
    9·2 answers
  • In Microsoft Word you can access the _______ command from the "Mini toolbar
    11·1 answer
  • If num is an int which expression always evaluates to true if num holds an odd number
    14·1 answer
  • A star appears under the <br> menu of the word processing program.
    5·1 answer
  • Henry, a graphic artist, wants to create posters. Which software should Henry use for this purpose?
    13·1 answer
  • What is java Encapsulation?​
    6·1 answer
  • Assume that the message M has to be transmitted. Given the generator function G for the CRC scheme, calculate CRC. What will be
    15·1 answer
  • Why can't this app have people ask riddles.
    8·1 answer
  • Why do you want to work from our company?​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!