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
__ is/are the amount of blank space between lines of text in a paragraph
Natali [406]
Indents? Double Space? one of those
5 0
3 years ago
Read 2 more answers
List five kinds of view in the computer and briefly define each​
mr Goodwill [35]

Answer:

It responds to a specific set of instructions in a well-defined manner. It can execute a prerecorded list of instructions (a program).

5 0
2 years ago
Which activity represents a violation of the licensing agreement?
Lena [83]
A) <span>unauthorized duplication of software </span>
6 0
2 years ago
Read 2 more answers
Anyone knows the answer for 6.1.4 Happy Birthday! codehs
Neko [114]

cvm is good cvm is great

7 0
2 years ago
you need to configure a wireless network using wpa2-enterprise. which of the following components should be part of your design?
Iteru [2.4K]

Answer: AES encryption

802.1x

Explanation:

4 0
1 year ago
Other questions:
  • Which of the following is important to do when downloading a game to your
    8·1 answer
  • . What may happen if a large number of computer users are attempting to access a Web site at the same
    10·2 answers
  • What category of sensory receptors are sensitive to touch sound and motion?
    10·1 answer
  • Read first a user's given name followed by the user's age from standard input. Then use an ofstream object named outdata to writ
    6·1 answer
  • You have to sort 1 GB of data with only 100 MB of available main memory. Which sorting technique will be most appropriate?
    5·1 answer
  • Determine the exact output of the code $str = "The quick brown fox jumps over the the lazy dog"; echo strpos($str, 'fox');
    6·1 answer
  • p25: File Write and Read1) User enters a file name (such as "myMovies.txt").2) User enters the titles of 4 of their favorite mov
    12·1 answer
  • Explain briefly why it is sometimes necessary to roll software back to a previous version, a procedure called "software
    9·1 answer
  • Assume that you have the business data in various sources such as Excel, .csv, text files and Access, Oracle databases. Write th
    9·1 answer
  • How do we Rewrite the following Python code to avoid error. mark=inpt("enter your mark ")
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!