Skip to content

Commit 84b628a

Browse files
Add files via upload
1 parent 8b82bf6 commit 84b628a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Krishnamurthy_Number_Checker.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
echo "Enter the Number"
2+
read x
3+
y=$x
4+
s=0
5+
while [ $x -gt 0 ]
6+
do
7+
r=$((x % 10))
8+
x=$((x / 10))
9+
p=1
10+
i=1
11+
while [ $i -le $r ]
12+
do
13+
p=$((p * i))
14+
i=$((i + 1))
15+
done
16+
s=$((s + p))
17+
done
18+
if [ $y -eq $s ]
19+
then
20+
echo "The Number is Krishnamurthy Number"
21+
else
22+
echo "The Number is not Krishnamurthy Number"
23+
fi
24+

0 commit comments

Comments
 (0)