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 Functions.



 #include <stdio.h>
int fact(int n)
{
	int facto = 1 ;
	for ( int i = n ; i > 0 ; i--)
	{
	
		facto  = facto * i ;
		
	}
	return facto ;
}

int main ()
{
	int num ;
	printf("Enter a number : ");
	scanf("%d" , &num);
	
	printf("Factorial of a given number %d = %d\n" , num , fact(num) );
	
	return 0 ;
}


No comments:

Post a Comment