NCDEX Interview Question

Write code for bisection method?