C Program to find the factorial of a given number

Program

#include<stdio.h>
void main()
{
	int num, fact = 1, i;
	printf("Enter a number to find the factorial\n");
	scanf("%d", &num);
	i = 1;
	while(i <= num)
	{
		fact = fact * i;
		i++;
	}
	printf("Factorial of %d is %d\n", num, fact);
}

Output

Enter a number to find the factorial
6
Factorial of 6 is 720