C Program to find the Factorial of a given number

Description for Factorial of a number (N):
     It is denoted as N!.Factorial of a positive number(N) can be found using the formula
                  N!=  N x (N-1) x (N-2) x (N-3) ............2x1.

Special cases:
          Factorial of a Zero is One.

        ex:
                  6!= 6 x 5 x 4 x 3 x 2 x 1 =720

For more detail, visit:
http://en.wikipedia.org/wiki/Factorial

Source Code:
/*
Program to find a factorial of a number
Author : sourcecodesonline.blogspot.com
*/
#include<stdio.h>
#include<conio.h>
int main(void)
{
 int no,i,fact=1;
  clrscr();
   printf("\nEnter the number: ");
   scanf("%d",&no);
    for(i=1;i<=no;i++)
    {
      fact=fact * i;
    }
   printf("\nThe factorial of number %d is %d\n",no,fact);
 return 1;
Previous
Next Post »

If you still didn't find what you're looking for, you can search this website below: