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
Which of the following would be the most appropriate way to address and greet your teacher, Mr. Joseph Herman, in an email? Hi J
Valentin [98]
To determine what would be the most appropriate way to address and greet your teacher during an email, we should eliminate some greetings, such as:
"Yo wassup?", "How  u doin?", or any other grammatical and socially inappropriate errors.
Let's look at our first option.
"Hi Joseph, How u doin??". This is incorrect as it is not appropriate to address anyone in such a manner and with grammatical errors.
Let's look at our second option.
"Dear Joseph Herman, how are you doing!!". This was on the right path, but didn't end well. The ending of the message, "how are you doing!!" is incorrect punctuation, and has too much excitement.
How about our third option?
"Dear Mr. Herman, I hope you're doing fine.". This is a great email. It has perfect punctuation, grammar, and is appropriate.
What about our fourth?
"Dear Joseph, i hope you are doing great.". This is a good email, but has incorrect punctuation.
Your answer is C.) Dear Mr. Herman, I hope you're doing fine.
8 0
3 years ago
PLEASE HELP SOMEONE!!!!!!!!! WILL GIVE BRAINLIEST!!!!!!!!!!!!!!!!!!!!!!!!! Fill in the blanks.
olasank [31]
<span> change the behavior of the program I think</span>
7 0
3 years ago
Three healthcare firms jointly own and share the same cloud resources to meet their computing needs. Which cloud model does this
Stels [109]

Answer:

yes

Explanation:

yall share the same thing

5 0
2 years ago
Why would students most likely need to collect data? Check all that apply
n200080 [17]
Well I would think all of them in some way. For the first one, students need to collect data (whether it’s mathematical, scientific, etc.) to answer a question. For the second one, they may need to know how much money is in there bank account or they may need to calculate a sale to order the item. For the third one, they may need statistical data to support a position. For the last one, a student could use technological data to be able to solve their problem sorting documents.
5 0
3 years ago
Read 2 more answers
Using the FAFSA form , you can for apply for what
AlladinOne [14]

apply for financial aid for college or grad school.

7 0
3 years ago
Read 2 more answers
Other questions:
  • How does the use of modules provide flexibility in a structured programming design?
    14·2 answers
  • Which files track internet usage and personal information when people visit websites?
    14·2 answers
  • A client accessing a network share folder has authenticated into the system and has full access rights to a folder share. But af
    11·1 answer
  • Which command can be used to manually add a package to the driver store?
    13·1 answer
  • When you park on a hill, think about which way _____.
    6·2 answers
  • Write a Python program that reads the CSV file, compares the population estimates of every row for 2010 and 2017 and computes th
    10·1 answer
  • Plot element is typically the turning point in the most intense moment of a story
    8·1 answer
  • Consider an application that transmits data at a steady rate (for example, the sender generates N-bit unit of data every k time
    7·1 answer
  • David is taking a test. To answer a question, he first covers up the answer choices. Next, he tries to answer the question. Then
    15·2 answers
  • ________(fill in the blank)in online education is intrinsically related to equity.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!