View difference between Paste ID: VMW2HjHi and Uvux3yBM
SHOW: | | - or go back to the newest paste.
1
#!/bin/sh
2
printf "Enter a number\n"
3
read c
4
x=$c
5
s=0
6
while [ $x -gt 0 ]
7
do
8
	r=`expr $x % 10`
9-
	s=`expr $sum + $r * $r * $r`
9+
	s=`expr $s + $r * $r * $r`
10
	x=`expr $x / 10`
11
done
12
if [ $s -eq $c ]
13
	then
14
		echo "It is an armstrong number"
15
	else
16
		echo "It is not an armstrong number"
17
fi