# C program to find the factorial using function

## C program to find the factorial of a given number using function

This page has included a C program to find the factorial of any given integer number using function. The Function is a user defined function. The function is used in the program to calculate the Factorial of number. Factorial of a number is denoted by n!.  Factorial is the product of all positive integers less than and equal to the number. For example, 4! = 4 × 3 × 2 × 1 = 24. Moreover, the factorial can be calculated only for positive integers. The below given C program will find the Factorial of a number using function.  Kindly check out the program to find the Factorial of a number using function.

### Factorial program using function

#include<stdio.h>
long int Factori(int);
int main(){
long int fact;
int numbr;

printf("Enter a number: ");
scanf("%d",&numbr);
fact= Factori(numbr);
printf("Factorial of %d is: %ld",numbr,fact);
return 0;
}

long int Factori(int n){
int i;
long int factorial;
factorial =1;
for(i=1;i<=n;i++)
factorial=factorial*i;
return(factorial);
}

Sample Output:

Enter a number:  4

Factorial of  4 is: 24

Enter a number:  6

Factorial of  6 is: 720

### Factorial using Function

The above C program will find the factorial using function. Kindly use the program to find the factorial using function.