# Factorial of Given Number

Factorial of given number is the mathematical problem. Factorial of number means the product or multiplication of the number till the given number. consider we having number N then factorial of number N we calculate as N! => N*(N-1)*(N-2)….

Example:   calculate 6 factorial

6! =6*5*4*3*2*1 =720

That is factorial of the number 6 is 720.

Using this technique we implement the factorial program in c.

We implement factorial program in c in two ways as :

1. Iterative method
2. Recursive method
3. Using pointers.

## Using iterative method:

This is first method using which we implement the factorial.

In this technique, we use the iterative loop as for loop to iterate and multiply the number up to N-1.

## Write a program to find factorial of number

Factorial

C

Output :

Enter the number to calculate factorial:

6      <-

Factorial of the number 6 is 720

In above program, we taken input from user to calculate factorial that is 6.now we calculate the factorial of the number using the formula N! .we taken for loop for calculating this till 6.

## Using recursive method

This is second method using which we implement the factorial.

In this technique, we recursively call the same function to calculate factorial.

Recursion: Function calling itself is referred as recursion.

## Write a program to find factorial of number using recursion.

C

Output :

Enter the number to calculate factorial:

6      <-

Factorial of the number 6 is 720

## Using Pointers method

This is third method using which we implement the factorial.

Pointers : pointers is the variable which stores the address of another variable.

## Program to find factorial of number using pointers.

C

Output :

Enter the number to calculate factorial:

6      <-

Factorial of the number 6 is 720

## Defining the recursion function.

factorial

C

Output :

Enter the number to calculate factorial:

6      <-

Factorial of the number 6 is 720