function that attempts to find the zero of a function using Newton’s Method

Newton’s Method
Write a function that attempts to find the zero of a function using Newton’s Method. The method requires four items

a function
the function’s derivative
an initial value that is close to a zero
number of iterations to perform
// The function to find the zero of : f(x).
//
double f(double x);

// The derivative of the function : f'(x).
//
double fPrime(double x);

// The function that applies Newton’s Method and returns the estimate of
// the zero.
//
// g : the function to find the zero of
// dg : the derivative of g
// initialValue : the initial values used to start the method
// iterations : the number of times to try to get a zero
//
// The function will return before the number of iterations is achieved
// if a zero is found.
//
double netwon(double (*g)(double),
double (*dg)(double),
double initialValue,
int iterations);

find the cost of your paper