DEV Community

Sivakumar Mathiyalagan
Sivakumar Mathiyalagan

Posted on

Armstrong number

What is armstrong number?
An Armstrong number (also called a narcissistic number) is a number that is equal to the sum of its own digits each raised to the power of the number of digits.

Examples
153
Digits: 1, 5, 3 (3 digits)
Calculation:
1*1*1 = 1
5*5*5 = 125
3*3*3 = 27
1 + 125 + 27 = 153

Code

Top comments (0)