Q:

C Program To Calculate Factorial Of A Given Number

belongs to collection: Basic C Programs for Practice

0

Write A C Program To Calculate Factorial Of A Given Number .
What Is Factorial :- In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n.

For example
5!=5*4*3*2*1=120.

The value of 0! is 1, according to the convention for an empty product*
The factorial operation is encountered in many areas of mathematics, notably in combinatorics, algebra, and mathematical analysis. Its most basic occurrence is the fact that there are n! ways to arrange n distinct objects into a sequence (i.e., permutations of the set of objects). This fact was known at least as early as the 12th century, to Indian scholars .
source :- Wikipedia

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<stdio.h>

int main()
{
 unsigned long long int fact=1;
  int i,num;
  
 printf("Enter The Number. You Want Factorial  :");
  scanf("%d",&num);
  
 for(i=1;i<=num;i++)
    {
        fact=fact*i;
    }
    
 printf("\nFactorial is = %llu\n",fact);
    return 0;

}

 

Output:

Enter the Number. You want Factorial : 10

Factorial is -3628800

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Program To Read Integer (N) And Print First Thre... >>
<< C Program To Find Character Is Vowel Or Not...