Question: Consider the following code that uses nBase as the base value and nExp as the exponent value to calculate nBase to the power of nExp:

Consider the following code that uses nBase as the base value and nExp as the exponent value to calculate nBase to the power of nExp:

 int Exponent(int nBase, int nExp) { int nValue = 1; for (int i=0; i < nExp; i++) nValue *= nBase; return nValue; } int main() { int result = 0; ______________________ } 

You need to call this function to update the result variable to hold the return value of the Exponent function provided here (do not use pow). Use a base value of 2 and an exponent value of 4 when calling Exponent. Use the literal digits 2 and 4 (do not use variables). Provide the missing line in the main function that will call the Exponent function and set the result variable equal to its return value. Your answer should be one C++ statement only.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!