py_assign4
py_assign4
Pege No 23
Title:
that qiven nuiber is.
Amsrong nmber Bo python.
*abjeches
Under stangl besicCacepls o poog anm
-Nig tangtge longuage ao ty to solve.
mbhenÑautca) Calecladion inproqramning
cpproch coith he helo ef ormwás
eqixahiog
*Pblem Stodemtat:
1o Cbeck whether: iogt nuber is
Acmstonq
ang numher0s not An Armstong
eamber is anintener cwith hre&
igibsSuch tat Bhe Sumb op the
di¡ib is
Ccbe o f t diqibs equal to
he numbey Jösel£.
Completioo ofo 8:s asinmend gtaclends.
ewil) ableto
Unclesslen fhe ockinq thoo
lopp
Duclens will be adle to tnoessaal besic
*soene & Hecunce oeqireonents
bgie
Hascloae eguremerts
Toeo (opcept
Te t)nderstand is eca ple yo ghecub hove
the konalecl efallaine pythen
pog seLming coaceptwith besic topics :
python if Else otategent
2.'pthon cehile laop
Mmynotes
My Knowledge bank
Date
Prge No 25)
Prtho A
stetemert fbeochet
Test
tepresaale
True
Boryc
Stetemet Sust,belbceo
poitve
Dumbe
psind This is clse cleys printel:)
goint
A posiliNe ineges is Calec ar
Armstöonq numbes a asoler n if abcol
anbnten + elnt
Tn Case of cyAtmsteoag number ol 3aligis's
mynotes
noledge bank
Date
Page No. 2
Alosthn i
Step L: SBast
Step2: Accept c oumber forth the useo
Step 2:ioitiaize Sm to O.
Step :findo
+ the Ceebe of each digit
o the entere ouher.
S: acb
Step Si ol te dit
e cube of c!
Step 6: IE eccepted andum
number
e equ, it Asmtong
Number.
BBep 7: En.
Llochabi Sast
acrept ea
iaitiaize Suneo
NO
Suo0U
Tyes
Mnyno'as
Pa tuy 27
oriq_ =sSumi
piin C"Armstsong numbes")
else:
Print " Not Amstnong numbex "")
Ouputi
Entes a Dumbes i343.
B43 net Asmstsong number
Estes a oumber : h03
A07 Aimstanq uaber
Conclusio n
Thus cwe hare stucioc pertocmed
numbes
CIrmston Canceptio Python
progsan nig
[4]: i=int (input("Enter Number to check for armst rong") )
Sum=0
orig=i
while (i>0):
sum=sum+(i%10) *(i%10) * (i%10);
i=i//10
if orig==sum:
print("Armstrong number")
else:
print(" Not Armst rong number")
Enter Number to check for armst rong 153
Armstrong number