echo "Enter
a number "
read n
s=0
num=$n
r=0
while [ $n != 0 ]
do
r=` expr $n \% 10 `
fact=1
nu=$r
while [ $nu -ge 1 ]
do
fact=` expr $fact \* $nu `
nu=` expr $nu - 1 `
done
s=` expr $s \+ $fact `
n=` expr $n \/ 10 `
done
if [ $s -eq $num ]
then
echo "Special"
else
echo "Not a Special"
fi
read n
s=0
num=$n
r=0
while [ $n != 0 ]
do
r=` expr $n \% 10 `
fact=1
nu=$r
while [ $nu -ge 1 ]
do
fact=` expr $fact \* $nu `
nu=` expr $nu - 1 `
done
s=` expr $s \+ $fact `
n=` expr $n \/ 10 `
done
if [ $s -eq $num ]
then
echo "Special"
else
echo "Not a Special"
fi
Comments