-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathP38.py
More file actions
33 lines (24 loc) · 639 Bytes
/
P38.py
File metadata and controls
33 lines (24 loc) · 639 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#python 3.7.1 by Ashutosh Krishna
#Finding factorial of each digit
def fact(n):
f = 1
for i in range(1,n+1):
f *= i
return f
num = int(input("Enter the number : "))
number = num #storing num into another variable number
sum = 0 #initialising sum with 0
while(num):
r = num%10 #finding the last digit
y = fact(r) #finding factorial of last digit
sum += y #adding the factorial of each last digit
num //= 10
if sum == number:
print(f"{number} is a Strong Number.")
else:
print(f"{number} is not a Strong Number.")
'''
OUTPUT
Enter the number : 145
145 is a Strong Number.
'''