#################################################
# To find the number is Armstrong or not #
#################################################
#!/bin/ksh
echo "This program is to find whether given number is Armstrong number or not”
# To make sure sufficient arguments
if [ $# -ne 1 ]
then
echo "Please provide one argument"
exit -1
fi
# Declaring and Assigning the values to the local variables
a=$1
s=0
# Logical part to find the Armstrong number
while [ $a -gt 0 ]
do
b=$(( $a%10 ))
s=$(( $s+$b*$b*$b ))
a=$(( $a/10 ))
done
if [ $s -eq $1 ]
then
echo "The given number is the Armstrong number"
else
echo "The given number is not Armstrong number"
fi
exit 0