Capgemini interview question

code for finding nth root