Program for Factorial in C

Here you will get program for factorial in C.

We can find factorial of any number by multiplying it with all the numbers below it.

For example, factorial of 3 will be 6 (3 * 2 * 1).

Program for Factorial in C

 

Output

Enter value of n:4

Factorial of 4 is 24

2 thoughts on “Program for Factorial in C

  1. Xenus Xerxii Masonius

    Recursion will do as well:

    unsigned long long f(int n)
    {
    if(n==0||n==1) return 1;
    else
    return n*f(n-1);
    }

    Reply
    1. Neeraj Mishra

      Yes, this can also be done by using recursive function. Thanks for your comment.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *