Final answer:
To complete the recursive function RaiseToPower(), you need to assign the correct value to the variable resultVal.
Step-by-step explanation:
To complete the recursive function RaiseToPower(), you need to assign the correct value to the variable resultVal. Here are the steps:
Check if the exponent value is 0 using an if statement. If it is, assign resultVal with 1.
If the exponent value is not 0, assign resultVal with 1.
Complete the else statement by recursively calling the RaiseToPower() function with the baseVal and exponentVal - 1 as the arguments. Multiply the result of the recursive call by the baseVal and assign it to resultVal.
Finally, return the value of resultVal at the end of the function.
For example, if the input values for baseVal and exponentVal are 2 and 4 respectively, the function will return 16, as 2 raised to the power of 4 is 16.
The solution for the Prime Checker function is similar. The function should return 1 if the input value is prime, and 0 otherwise. Here are the steps to complete the function:
Check if the input value is 0 or 1 using an if statement. If it is, assign primeResult with 0.
If the input value is not 0 or 1, check if it is only divisible by 1 and itself using an if statement with a modulo operation. If it is, assign primeResult with 1.
If the input value is not divisible by only 1 and itself, assign primeResult with the result of the recursive call to PrimeChecker() with the input value and divVal - 1 as the arguments.
Finally, return the value of primeResult at the end of the function.