Question: 0. A Math Library functions, simple recursions (5pt) Specification Write an ANSI-C program that reads input from the standard input, which contains one double and

0. A Math Library functions, simple recursions (5pt) Specification Write an ANSI-C program that reads input from the standard input, which contains one double and one integer representing a base b and exponent (i.e., power) n, and then calculates b. After reading base and exponent from the user, the program first calls the math library function pow(), and then call function my_pow(), which is a recursive function that you are going to implement here. The program keeps on prompting user and terminates when user enters -1000 for base (followed by any number for exponent). Implementation Download file labSpow.c and start from there. Note that to read a double using scanf, we need to use $11. (is use for float). Your function my_pow(double, double) should be RECURSIVE, not ITERATIVE. That is, the function should be implemented using RECURSION, not loops. In a recursive solution, the function calls itself with different (usually smaller) inputs, until the input becomes small enough so that we can solve the case directly. This case is called a base case. Note that although the function's parameters are of type double, the actual argument for exponent is assumed to be an integer literal (i.e. the power will not be 3.5). However, the power can be negative. Your functions should handle this. Sample Inputs/Outputs red 1174 a.out Enter base and power: 10 2 pow: 100.0000 my_pow: 100.0000 Enter base and power: 10 4 pow: 10000.0000 my_pow: 10000.0000 Enter base and power: 2 3 pow: 8.0000 my_pow: 8.0000 2 Enter base and power: 2.35 pow: 64.3634 my_pow: 64.3634 Enter base and power: -2 4 pow: 16.0000 my_pow: 16.0000 Enter base and power: -2.75 5 pow: -157.2764 my_pow: -157.2764 Enter base and power: 2 - 3 pow: 0.1250 my_pow: 0.1250
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
