Thursday, May 1, 2008

Write a shell script to find factorial of a number.

echo “Enter number”

read n

$i=1

$f=1

while [$i -lt $n]

do

expr ‘$f=$f\*$i’

expr ‘$i=$i +1’

done

echo “Factorial is...$f”

No comments: