3. WASS to find the factorial of a number
Page 1 of 1
3. WASS to find the factorial of a number
clear
echo "Enter a number"
read n
f=$n
n=`expr $n - 1`
while test $n -gt 0
do
f=`expr $f \* $n`
n=`expr $n -1`
done
echo "The factorial is $f"
echo "Enter a number"
read n
f=$n
n=`expr $n - 1`
while test $n -gt 0
do
f=`expr $f \* $n`
n=`expr $n -1`
done
echo "The factorial is $f"
sowmya- Posts : 5
Join date : 2010-07-21
Similar topics
» 8. WASS to accept 2 x and y , and find the XY ( x raised to the power y )
» WASS to accept a string from the user and display number of vowels
» To reverse a given 5 digit Number
» 2. Write a shell script to reverse a 5 digit number
» Prog 1 Write a shell script to find the length of the accepted string
» WASS to accept a string from the user and display number of vowels
» To reverse a given 5 digit Number
» 2. Write a shell script to reverse a 5 digit number
» Prog 1 Write a shell script to find the length of the accepted string
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum