Subscribe for more such posts..

Dear Reader...
I hope u are like my posts. If so then please don't forget to like , share and follow my blog for more such posts ,also feel free to write suggestions in the comment box given over here.

Thank you...

Search This Blog

C program to find the Factorial of a given number using Recursion.



 #include <stdio.h>
int fact(int n )
{
	if(n >= 1)
	return n * fact(n - 1);
	else
	return 1 ;

}



int main()
{
	
	int num;
	printf("Enter an integer : ");
	scanf("%d" , &num);
	printf("Factorial of %d is : %d\n" , num , fact(num));
	
	return 0 ;
	
}

No comments:

Post a Comment