C Program - (Recursion method) Factorial of number using function














#include<stdio.h>


unsigned long long int factorial(unsigned int number);



int main(void)


{


       unsigned int i;


       printf("Enter Any Number = ");



       scanf("%d", &i);


       printf("\nThe Factorial of Number %d is %llu.", i, factorial(i));


       getch();


}



unsigned long long int factorial(unsigned int number)


{


       if (number <= 1){


              return 1;


       }


       else {


              return (number*factorial(number - 1));


       }


}



















Comments

Popular posts from this blog

How to Block Websites without using any Software.

C Program - Greater, less and Equal

C Program - Even Odd