clear
echo “ Enter values for n & r”
read n
read r
t=0
i=1
a=1
b=1
c=1
d=0
while [ $i –le $n ]
do
a=`expr $a \* $i`
i=`expr $i + 1`
done
i=1
while [ $i –le $r ]
do
b=`expr $b \* $i`
i=`expr $i + 1`
done
i=1
d=`expr $n - $r`
while [ $i –le $d ]
do
c=`expr $c \* $i`
i=`expr $i + 1`
done
i=`expr $b \* $c`
t=`expr $a / $i`
echo “ The Result Is = $t”
OUTPUT:
Enter values for n & r
4
2
The Result Is = 6
thank u so much for your valuable comment... I'll try my best to more improvement..
ReplyDeleteWow! This is exactly what I was searching for. I'm not good in writing shell scripts. Can you post more with descriptions. Regards.
ReplyDeleteUnix Course in Chennai | Unix Training institutes in Chennai | Unix Shell Scripting Training in Chennai | Unix Training