Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Python code to check armstrong number
SUBMITTED BY:
Bun
DATE:
Feb. 7, 2016, 10:10 p.m.
FORMAT:
Python 3
SIZE:
299 Bytes
Raw
Download
Tweet
HITS:
1495
Go to comments
Report
#Python Program to check Armstrong Number:
number
=
int
(
input
(
"Please enter a number: "
))
sum
=
0
temp
=
num
while
temp
>
0
:
dgt
=
temp
%
10
sum
+=
dgt
**
3
temp
//=
10
if
num
==
sum
:
print
(
num
,
"it is an Armstrong number"
)
else
:
print
(
num
,
"it is not an Armstrong number"
)
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus