Question: Create a C-Program that will take the square root of a number using a square-root function that corresponse to the following protoype: double mySqrt(double x);
Create a C-Program that will take the square root of a number using a square-root function that corresponse to the following protoype: double mySqrt(double x); (for x => 0)
Please use the Newton-Raphson equation:


Relative error:

-"Find the quare root of" Displays on the screen when ran. User enters a number and hits return, and then the application prints the quare root of the number enter, or an error message if the user enters a negative number.
- The function should check to make sure the number entered by the user is not negative. If the user enters a negative number and that negative number is given to the function mySqrt(x), mySqrt(x) should return -1 as an error code. The main program can check for the error code and decide what message to print to the user if the error code is returned.
- To calculate the relative error, you will need an absolute value function. You can write your own, or use the fabs( ) function from the #include library.
Thank you!
UPDATE:




k+1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
