# C tutorial-factorial program in C language

To find the Factorial of any number in C programming language .

• What is Factorial number ?

Ans-

In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,

{\displaystyle 5!=5\times 4\times 3\times 2\times 1=120.\ }

The value of 0! is 1, according to the convention for an empty product.

Some Factorial numbers n! of number n. Examples:—-

n n!
0 1
1 1
2 2
3 6
4 24
5 120
6 720
7 5040
8 40320
9 362880
10 3628800
11 39916800
12 479001600
13 6227020800
14 87178291200
15 1307674368000
16 20922789888000
17 355687428096000
18 6402373705728000
19 121645100408832000
20 2432902008176640000
25 1.551121004×1025
50 3.041409320×1064
70 1.197857167×10100
100 9.332621544×10157
450 1.733368733×101000
1000 4.023872601×102567
3249 6.412337688×1010000
10000 2.846259681×1035659
25206 1.205703438×10100000
100000 2.824229408×10456573
205023 2.503898932×101000004
1000000 8.263931688×105565708
10100 109.956570552×10101

Write a  Program in C prgramming language in some  way or method following below:-

Code 1:

1. -C code for factorial of a number
2. C program to find the factorial of a given number
3. Factorial program in c using while loop
4. Factorial program in c without using recursion
#include

int main(){

int i=1,f=1,num;

printf("Enter a number: ");

scanf("%d",&num);

while(i

Sample output:
Enter a number: 5
Factorial of 5 is: 120
Code 2:
Factorial program in c using for loop
Simple factorial program in c
C program to calculate factorial
#include

int main(){

int i,f=1,num;

printf("Enter a number: ");

scanf("%d",&num);

for(i=1;i

Code 3:
Factorial program in c using pointers
How to calculate factorial in c
Factorial program in c language
#include

void findFactorial(int,int *);

int main(){

int i,factorial,num;

printf("Enter a number: ");

scanf("%d",&num);

findFactorial(num,&factorial);

printf("Factorial of %d is: %d",num,*factorial);

return 0;

}

void findFactorial(int num,int *factorial){

int i;

*factorial =1;

for(i=1;i

Code 4:
Factorial program in c using function
C program to find factorial of a number
#include

int findFactorial(int);

int main(){

int i,factorial,num;

printf("Enter a number: ");

scanf("%d",&num);

factorial = findFactorial(num);

printf("Factorial of %d is: %d",num,factorial);

return 0;

}

int findFactorial(int num){

int i,f=1;

for(i=1;i

Sample output:
Enter a number: 8
Factorial of 8 is: 40320

Code 5:
Factorial series in c
#include

int main(){

long f=1;

int i,num,min,max;

printf("Enter the minimum range: ");

scanf("%d",&min);

printf("Enter the maximum range: ");

scanf("%d",&max);

printf("Factorial series in given range: ");

for(num=min;num
Sample output:
Enter the minimum range: 1
Enter the maximum range: 10
Factorial series in given range: 1 2 6 24 120 720 5040 40320 362880 3628800Algorithm:
Factorial value
Factorial of number is defined as:
Factorial (n) = 1*2*3 … * n
For example: Factorial of 5 = 1*2*3*4*5 = 120
Note: Factorial of zero = 1
The post C tutorial-factorial program in C language appeared first on Easyway2learn.

This post first appeared on Easy 2 LearN, please read the originial post: here

# Share the post

C tutorial-factorial program in C language

×