Shell Script to find factorial of a number
Program
#! /bin/bash
echo "Enter a number"
read num
fact=1
n=$num;
while [ $num -ge 1 ]
do
fact=`expr $fact \* $num`
num=`expr $num - 1`
done
echo "Factorial of $n is $fact"
Output
$ sh factorial-of-number.sh
Enter a number
7
Factorial of 7 is 5040