Factorial Number

Factorial Number: The product of an integer and all the integers below it; e.g. factorial four ( 4! ) is equal to 24.
4! = 4 × 3 × 2 × 1 = 24

Code

#include <stdio.h>

unsigned long long int factorial(unsigned int i) {

   if(i <= 1) {
      return 1;
   }
   return i * factorial(i - 1);
}

int  main() {
   int i = 12;
   printf("Factorial of %d is %d\n", i, factorial(i));
   return 0;
}

Output
Factorial of 12 is 479001600

top wedding photographerin bangladesh

Related posts

Leave a Comment