unsigned long n = 5; unsigned long factorial(unsigned long n) { return n>1 ? n*factorial(n-1) : 1; } int main() { return factorial(n); }