Write a shell script to check entered number is perfect or not
echo Enter a number to find its perfect or not.
read no
i=1
ans=0
while [ $i -le `expr $no / 2` ]
do
if [ `expr $no % $i` -eq 0 ]
then
ans=`expr $ans + $i`
fi
i=`expr $i + 1`
done
if [ $no -eq $ans ]
then
echo $no is perfect number.
else
echo $no is not a perfect number.
fi
Shopping In MUMBAI
Are you searching for Discounts, offers, sale in Mumbai ? You are in the right place. MUMBAI, a shopping haven, has no dearth of great discounts and sales. This blog features the best MUMBAI shopping offers, sale, discounts and deals and bargains CURRENTLY GOING on in Mumbai plus a few free things thrown in on top.
Don't wait for it because once they are gone, they are gone. Hurry!..By clicking the "Like" button you will receive a daily update of discounts, sale, offers going on in Mumbai. LIKE IT.... SHARE IT...njoY.
Thursday, February 5, 2009
Program in UNIX to check entered number is perfect or not
Posted by ars at 5:33 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment