1 1 calculate factorial write a function that calculates factorial of a number facto 5347058
1.1 Calculate Factorial
Write a function that calculates factorial of a number. Factorial function should
accept integer number n as input and return the factorial of a number. Proto-
type of a factorial function is: unsigned long factorial (int n). Using for
loop, print factorial for n = 0 to 10. Output should looks like as follows.
factorial output:
0! = 1
1! = 1
2! = 2
3! = 6
4! = 24
5! = 120
6! = 720
7! = 5040
8! = 40320
9! = 362880
10! = 3628800
Hint: The factorial of a integer n, denoted by n!, is the product of all positive
integers less than or equal to n. For example, 5! = 5 4 3 2 1 = 120.
0! is a special case that is explicitly dened to be 1. There are many ways to
implement factorial function. You can use for loop to implement factorial.