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 is a new feature in Windows Server 2016 that enables block-level data replication to occur automatically
Inessa [10]

Answer:

Option C is the correct answer for the above question

Explanation:

  • The storage replica is a new advantage that is used in the 2016 version of the windows server. It is a feature which is very useful for the user point of view, because of it more secure the data transfer on the internet.
  • It is used to block the duplicate data, by which the storage space is left for the other data and the data will secure when it stores on the server.
  • The above question asked about the features which are a new advantage of the 2016 version and provide block facilities for the duplicate data which is storage Replica which is defined above.
  • Hence the correct option is C, while the other is not because others is not a feature to block the duplicate data.
7 0
3 years ago
Looking at the response vehicles (pictured above), explain two options you have in order to abide by the Move Over law,
Nesterboy [21]

Answer: two options I have in order to abide by the move over law is to either move over or slow down. You must move over a lane away from stationary emergency vehicles if it is safe to do so. If it is not safe to do so then the driver must proceed with due caution, with a safe speed for road conditions.Until the driver has passed the emergency vehicle.

Explanation:Let me know if this helped! (:

6 0
3 years ago
Read 2 more answers
In mathematics, the factorial of a positive integer n, denoted as n! , is the product of all positive integers less than or equa
MrRa [10]

Answer:

public static int factorial(int n) {

   

    if (n >= 1 && n <=12) {

           if (n==1)

               return 1;

           else

               return n * factorial(n-1);

    }

    else

        return -1;

}

Explanation:

Create a method called factorial that takes one parameter, n

Check if n is n is between 1 and 12. If it is between 1 and 12:

Check if it is 1. If it is 1, return 1. Otherwise, return n * function itself with parameter n-1.

If n is not between 1 and 12, return -1, indicating that the number is not in the required range.

For example:

n = 3  Is n==1, NO factorial(3) = n*factorial(2)

n = 2  Is n==1, NO factorial(2) = n*factorial(1)

n = 1  Is n==1, YES factorial(1) = 1.

Then factorial(2) = 2*1 = 2, factorial(3) = 3*2 = 6

6 0
4 years ago
Read 2 more answers
You'd like to create remarketing lists based on your customer's journey through your website so that you can target them with di
Marat540 [252]
The term homepage visitors <span>describes the users that visited your homepage, but didn't move any further into your site. 
</span><span>Homepage denotes the main initial web page of a website.
</span><span>The first web page people see when they arrive on a website is also known as the "landing page".</span>
4 0
4 years ago
One main advantage of CD-ROMs is that..
Alona [7]
CD-ROMs can hold a lot of information.
4 0
4 years ago
Other questions:
  • Let's write a simple markdown parser function that will take in a single line of markdown and be translated into the appropriate
    10·1 answer
  • The source ip address is 164.109.28.3 subnet mask of 255.255.128.0 network address is
    7·1 answer
  • A(n) ____ is a collection of one or more program statements combined to perform some action
    14·1 answer
  • Write down the pseudo code of a program that calculates the Body Mass Index (BMI) of
    9·1 answer
  • What is the result of giving the which utility the name of a command that resides in a directory that is not in your search path
    10·1 answer
  • Dwight <br> d. eisenhower was impressed with germany's network of highways and how it __________.
    15·1 answer
  • Which of the following scenarios can best be addressed by operations management?
    11·1 answer
  • How can your microsoft word processing skills affect overall writing skills on the job?<br><br>​
    7·1 answer
  • Which of the following is not a benefit provided by a stakeholder analysis document
    7·1 answer
  • Please help me answer this question
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!