Hey If you are beginner and want to learn a python then you are on right path. Learn basic as well as advanced programming in Python.

Search

Python program to check whether entered number is Armstrong number or not.

PYTHON PROGRAM



"""
Python Program for Armstrong number
"""

n1=(int(input("Enter a number:")))

n2=n1

s=0

while n1>0:

r=n1%10

s=s+r*r*r

n1=n1//10

if n2==s:

print ("\n",n2, "is Armstrong number")

else:

print ("\n",n2, "is not Armstrong ")





*** Input && Output ***






No comments:

Post a Comment

let me know which type examples you want to comment me.