Write a shell script to find the factorial of a given number.

echo -e “Enter the number::\c”

read n

fact=1

for((i=1;i<=n;i++))

{

fact=expr $fact \* $i

}

echo “Factorial of the $n is::”$fact

 

OUTPUT::

 

Enter the number::5

Factorial of the 5 is::120

 

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.