FACTORIAL
clear
#factorial of n numbers
echo "enter the number"
read num
fact=1
for((i=1;i<num+1;i++))
do
fact=`expr $fact \* $i`
done
echo "the factorial of $num is
$fact"
OUTPUT:
enter the number
5
the factorial of 5 is 120
[2k7ca324@localhost ~]$
No comments:
Post a Comment
Thanks for your valuable comments