Headlines
Loading...
Program in UNIX to compute factorial of a positive integer

Program in UNIX to compute factorial of a positive integer

Write a shell script to compute factorial of a positive integer
echo Enter a number to find its factorial
read no
i=1
ans=1
while [ $i -le $no ]
do
        ans=`expr $ans "*" $i`
        i=`expr $i + 1`
done
echo Factorial of $no is $ans.
*** PLEASE checkout the Best deals from for top sites like Amazon, Flipkart etc ***