Goldman Sachs interview question

Write a program which performs Newton's Method to approximate the root of an arbitrary function.