TotalCodes
Menu
Android
Data Structure
Oracle(PL/SQL)
Shell Scripts
Monday, 27 May 2013
Shell Script to find factorial of a number
n=0
ip=0
fact=1
echo -n "Enter number to find factorial : "
read n
ip=$n
while [ $n -ge 1 ]
do
fact=`expr $fact \* $n`
n=`expr $n - 1`
done
echo "Factorial for $ip is $fact"
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment