Python Program:

- To check number is Armstrong or not

Example:

User Input:1

Output: Armstrong Number

num=int(input("Enter your number : "))
sum = 0
num2=num
while num!=0 :
  digit=num%10
  sum+=digit*digit*digit
  num=int(num/10)
if num2==sum : 
  print("Armstrong Number")
else :
  print("Not a Armstrong Number")

Output:

  Enter Your number : 407
  Armstrong Number
Program
number

You must know first,

Armstrong Number : if a number & cube of every single digit of the number are equal than the number is an Armstrong number

Example :

Number: 407 & cube of every single digit = 407. so it's an Armstrong Number
(4*4*4)+(0*0*0)+(7*7*7) = 64+0+343 = 407

#Save the original number
num2=num

#find every single digit & add the cube of it
while num!=0 :
  digit=num%10
  sum=sum + digit*digit*digit
  num=int(num/10)

#check for the Armstrong
if num2==sum :
Concept

Coming Soon !

Quick
Tutorial

Quote

We are all now connected by the Internet, like neurons in a giant brain.