C program to find factorial of a number

C program to find factorial of a number

 Factorial of n is the product of all positive descending integers. Factorial of n is denoted by n!. For example 7! =7*6*5*4*3*2*1. By implementing this logic we create a program to find the factorial of a given number. This is an important and a favourite question asked by the examiner in the interviews. 


/*
	Find the factorial of a number
	Author 			: 		Krishna Teja G S
	Repository		:		github.com/packetprep/coding-questions
	Website			: 		packetprep.com
*/

#include
int findFactorial(int );



int main(){

	int number,factorial;

	printf("Enter a positive integer: ");
	scanf("%d",&number);

	factorial = findFactorial(number);
	printf("The Factorial of the number %d is : %d \n",number, factorial);
	

}

int findFactorial(int n){
	
	int i,factorial=1;

	for(i=1;i<=n;i++)
	{
		factorial = factorial * i;
	}
	
	return factorial;
}
wipro free mock test
Wipro National Qualifier Test is just a few days away. To help you crack the exam we are sharing a mock test specially designed for Wipro based on all the previous papers.