Computer Science, asked by akshay14794, 1 month ago

Armstrong no. In python

Answers

Answered by BrainlyProgrammer
6

What is Armstrong Number?

  • A number is said to be Armstrong if the sum of digits to power no. of digits is equal to the original number or not
  • Example:
  1. 153 ---> 1³+5³+3³=153
  2. 1634 ---> 1⁴+6⁴+3⁴+4⁴=1634

Required Answer:-

k=(int)(input("Enter a number"))

k1,c,s=k,0,0

while (k!=0):

‎‎‎‎c+=1

‎‎‎‎k//=10

k=k1

while (k!=0):

‎‎‎‎s+=(k%10)*‎*c

‎‎‎‎k//=10

if(k1==s):

‎‎‎‎print("Armstrong Number")

•Required Output Attached.

Attachments:
Similar questions