Python

Number of Armstrong in Python1 min read

A positive number is called an Armstrong number if it is equal to the sum of the cubes of its numbers, for example 0, 1, 153, 370, 371, 407, etc.

In other words, the following equation will be verified

xy..z = xn + yn + ….. + zn




n is the number of digits

For example, 370 is a 3-digit Armstrong number

370 = 33 + 73 + 03
= 27 + 343 + 0
= 370

Now, let’s see the implementation of Armstrong’s number in Python.

Program to check if the given number is an Armstrong number

Output:

 

 

Leave a Comment