Texas A&M University interview question

Write a programming function.