SP – Factorial

# Shell Programming

# Factorial of a number

echo -n “Enter N : ”

read n

i=1

fact=1

while [ $i -le $n ]

do

fact=`expr $fact \* $i`

i=`expr $i + 1`

done

echo “Factorial of $n = $fact”