Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- printf "Enter a number\n"
- read c
- x=$c
- sum=0
- r=0
- while[ $x -gt 0 ]
- do
- r=`expr $x % 10`
- n=`expr $r \* $r \* $r`
- sum=`expr $sum + $n`
- x=`expr $x / 10`
- done
- if[ sum -eq $c]
- then
- echo "It is an armstrong number"
- else
- echo "It is not an armstrong number"
- fi
Advertisement
Add Comment
Please, Sign In to add comment