Jan 1, 2018

Calculate factorial value of any number using awk command

Updated: Mar 17, 2021

BEGIN
 
{ main(); }
 
function main()
 
{ facto(); }
 
function facto()
 
{
 
printf("\n Enter The Number: ");
 
getline n;
 
fact=1;
 
for(i=n;i>1;i--)
 
fact=fact*i;
 
printf("\nFactorial of %d is %d",n,fact);
 
}