eTT Aviation interview question

Loops, recursion questions, had to do it in a text editor.