BT Group interview question

Write a function that works out n factorial