We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 02ac36d commit 4e57821Copy full SHA for 4e57821
1 file changed
strongNumber.py
@@ -0,0 +1,18 @@
1
+#A Strong number is a number whose sum of factorials of digits is equal to the same number.
2
+#Example: 145 is a Strong Number (1!+4!+5! = 145)
3
+
4
+num = int(input("Enter a number\n"))
5
+temp = num
6
+sum = 0
7
+while(temp > 0):
8
+ d = temp % 10
9
+ f = 1
10
+ while(d > 0):
11
+ f = f * d
12
+ d -= 1
13
+ sum += f
14
+ temp = temp // 10
15
+if sum == num:
16
+ print("%d is a Strong Number" %(num))
17
+else:
18
+ print("%d is NOT a Strong Number" %(num))
0 commit comments