Halliburton interview question

How would you write a program to do blank.