Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

image text in transcribed

Relative error:

image text in transcribed

-"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:

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

k+1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

Describe the nature of negative messages.

Answered: 1 week ago

Question

1. Select the job or jobs to be analyzed.

Answered: 1 week ago