We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents cb88b10 + 7ed684d commit 8099fa8Copy full SHA for 8099fa8
1 file changed
arm
@@ -0,0 +1,20 @@
1
+# Python program to check if the number is an Armstrong number or not
2
+
3
+# take input from the user
4
+num = int(input("Enter a number: "))
5
6
+# initialize sum
7
+sum = 0
8
9
+# find the sum of the cube of each digit
10
+temp = num
11
+while temp > 0:
12
+ digit = temp % 10
13
+ sum += digit ** 3
14
+ temp //= 10
15
16
+# display the result
17
+if num == sum:
18
+ print(num,"is an Armstrong number")
19
+else:
20
+ print(num,"is not an Armstrong number")
0 commit comments