We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 661a883 + c98f56c commit a46ec79Copy full SHA for a46ec79
1 file changed
kousik.py
@@ -0,0 +1,22 @@
1
+# https://www.facebook.com/kousik.snai.7/posts/995929887498735
2
+# subscribed by Code House
3
+# Python program to check if the number is an Armstrong number or not
4
+
5
+# take input from the user
6
+num = int(input("Enter a number: "))
7
8
+# initialize sum
9
+sum = 0
10
11
+# find the sum of the cube of each digit
12
+temp = num
13
+while temp > 0:
14
+ digit = temp % 10
15
+ sum += digit ** 3
16
+ temp //= 10
17
18
+# display the result
19
+if num == sum:
20
+ print(num,"is an Armstrong number")
21
+else:
22
+ print(num,"is not an Armstrong number")
0 commit comments