Question: MATH 21 SPRING 2019 Part III: Answer ALL questions in this section. Each question is worth 5 points. 11. Compute: 12345+ 43215 12. Compute:

MATH 21 SPRING 2019 Part III: Answer ALL questions in this section. Each question is worth 5 points. 11. Compute: 12345+ 43215 12. Compute: 10012+ 10112 13. Compute: 2356 + 1346 14. Compute: 7689 +2819 15. Compute: 11002-10112 16. Compute: 4007-3667 17. Compute: 7658-6778 BCC 1. This problem considers two ways to compute x" for some n 0. a. Write an iterative method powerl to compute x" for n 0. b. Write a recursive method power2 to compute x" by using the following recursive formulation: xo=1 x = x* x-1 if n>0 c. Write an accompanying main method which invokes both power1 and power2 for increasing values of n = 0 up to n = 10. For the purpose of this exercise, give x a fixed value of 2.0 and change only the value of n. You probably want to change the value of n in a loop, as I have done in my solution to this exercise. Here is an example test run of the main method I wrote to solve this exercise: 2.0 0 1.0 computed iteratively. 2.0^0 1.0 computed recursively. 2.0^1 2.0 computed iteratively. 2.0^1 2.0 computed recursively. 2.0 24.0 computed iteratively. 2.0 24.0 computed recursively. 2.0 3 8.0 computed iteratively. 2.0 3 8.0 computed recursively. 2.0 4 16.0 computed iteratively. 16.0 computed recursively. iteratively. 2.0 4 2.0 5 32.0 computed 2.0^5 32.0 computed recursively. 2.0^6=> 64.0 computed iteratively. 2.0^6 2.0 7 = 64.0 computed recursively. 128.0 computed iteratively. 2.0 7 128.0 computed recursively. 256.0 computed iteratively. 2.0 8 2.0^8 256.0 computed recursively. 2.0^9 512.0 computed iteratively. 512.0 computed recursively. 2.0^9 2.0 10 1024.0 computed iteratively. 2.0^10 1024.0 computed recursively. Notice that all of the computed values are identical, but power1 computes its value using a loop, and power2 computes its value by means of recursion (5 points).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
