func factorial n . r = 1 for i = 2 to n : r *= i return r . print factorial 7