Tutorials

What Is The Factorial Of Hundred : Mathematics Formula, C Program, Python Program

What Is The Factorial Of Hundred
Written by itsubuntu

The factorial of hundred is 9.3326215443944E+157

Factorial in mathematics is defined as the product of all the positive numbers less than or equal to that number. Factorial is also denoted by the word bang or shriek. If you want to calculate the factorial of 6 then the result will be the product of 6x5x4x3x2x1.

Factorial Formula is n! = n × (n-1) × (n-2) × (n-3) × …× 3 × 2 × 1. Here you might see one interesting pattern as the factorial of any number is, the given number, multiplied by the factorial of the previous number. Factorial of a negative number is undefined. factorials are commonly used is in permutations & combinations.

What Is The Factorial Of Hundred

If you want to calculate the factorial of hundred then you can simply put the 100 in the above formula and the result that you get is the factorial of 100.

Factorial Formula for 100 is 100! = 100 × (100-1) × (100-2) × (100-3) × …× 3 × 2 × 1.

Similar to other numbers, you can follow the same formula and calculate the result.

Factorial of 99 is 99!= 99x(99-1)x(99-2)x..x3x2x1.

Factorial of 1000 is 1000!=1000x(1000-1)x(1000-2)x…x3x2x1.

Shell Script To Find Factorial Of A Number [Linux User]

Using loop method.

echo "Enter a number to calculate the factorial number"

read numb                     

fact=1                    

for((i=2;i<=numb;i++))
{
  fact=$((fact * i)) 
}

echo $fact

Output:

Enter a number
3
6

Enter a number
8
40320

Enter a number
5
120

 

Using the do-while method.

echo "Enter a number to calculate factorial"
read number

fact=1

while [ $numb -gt 1 ]
do
  fact=$((fact * numb))  
  num=$((numb - 1))      
done

echo $fact

Output:

Enter a number
3
6

Enter a number
8
40320

Enter a number
5
120

Write A C Program To Calculate A Factorial

Factorial Program In C using loop

#include<stdio.h>  

int main()    

{    

 int i,fact=1,num;    

 printf("Enter a number to calcuate in C program: ");    

  scanf("%d",&numb);    

    for(i=1;i<=numb;i++){    

      fact=fact*i;
  }    

  printf("Factorial of %d is: %d",numb,fact);    

return 0;  

}

Output:

Enter a number: 3
Factorial of 3 is: 6

Factorial program in c using recursion function

#include<stdio.h>  

  

long factorial(int n)  

{  

  if (n == 0)  

    return 1;  

  else  

    return(n * factorial(n-1));  

}  

   

void main()  

{  

  int numb;  

  long fact;  

  printf("Enter a number: ");  

  scanf("%d", &numb);   

   

  fact = factorial(numb);  

  printf("Factorial of %d is %ld\n", numb, fact);  

  return 0;

Python Program To Find The Factorial Of A Number Using Loop

num = int(input("Enter a number: "))

fact =1

if num <0:
   print("Sorry,You entered negative number as factorial does not exist for negative numbers")
elif num == 0:
   print("The factorial of 0 is 1")
else:
   for i in range(1,num + 1):
       fact = fact*i
   print("The factorial of",num,"is",fact)

About the author

itsubuntu

Leave a Comment