Shell Programming - Factorial of a number

# 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"



No comments:

Post a Comment

Don't be a silent reader...
Leave your comments...

Anu