AVEVA Interview Question

Write a function in any language to calculate a factorial.