C Program to Find Factorial of a Number

In this program, you will learn how to find factorial of a number. The factorial of a number is the product of all the integers from 1 to that number. For example, the factorial of 4 (denoted as 4!) is 1*2*3*4 = 24. Factorial is not defined for negative numbers and the factorial of zero is one, 0! = 1 .

Source Code
#include <stdio.h>
int main()
    int no, fact = 1;
    printf("Enter the number: ");
    scanf("%d", &no);

    while(no > 0)
        fact = fact * no;
    printf("Factorial of given number is: %d", fact);
    return 0;
Enter the number: 4
Factorial of given number is: 24

Enter the number: 7
Factorial of given number is: 5040

"Coding Hub - Learn to code" app now available on Google Play Store