Check out example codes for "factorial of a given number in c". It will help you in understanding the concepts better.

Code Example 1

//Factorial of a given number #include <stdio.h>  //This function returns factorial of the number passed to it  long int factorialOf(int number){     long int factorial = 1;     while(number){         factorial*=number;         number-=1;     }     return factorial; }  int main(void) { 	int n; 	printf("Find factorial of \n"); 	scanf("%d",&n); 	printf("\nThe factorial of %d is %ld",n,factorialOf(n)); 	return 0; }

Learn ReactJs, React Native from