View difference between Paste ID: Uvux3yBM and ErnBVuxM
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-
r=0
6+
7
do
8
	r=`expr $x % 10`
9
	s=`expr $sum + $r * $r * $r`
10-
	n=`expr $r \* $r \* $r`
10+
11-
	s=`expr $sum + $n`
11+
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