URDINESH: SHELL SCRIPT TO FIND FACTORIAL
Showing posts with label SHELL SCRIPT TO FIND FACTORIAL. Show all posts
Showing posts with label SHELL SCRIPT TO FIND FACTORIAL. Show all posts

Sunday, July 19, 2015

SHELL SCRIPT TO FIND FACTORIAL

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 ~]$

Followers