Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- printf "Enter a number\n"
- read c
- x=$c
- s=0
- while [ $x -gt 0 ]
- do
- s=(( s + x % 10 * x % 10 * x % 10 ))
- x=`expr $x / 10`
- done
- if [ $s -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
Advertisement