Display Armstrong Numbers in Java

This post shows how you can generate and display Armstrong numbers in Java with in the given range. A number is an Armstrong number if it is equal to the sum of its digit raised to the power of count of digits in the number.

As example – 371 = 33 + 73 + 13 = 27 + 343 +1 = 371

Number of digits is 3 here so every digit is raised to the power of 3 and added. Since the calculated number is equal to the original number so 371 is an Armstrong number.

1634 = 14 + 6 4 + 34 + 44 = 1 + 1296 + 81 + 256 = 1634

Display Armstrong numbers within the given range – Java Program

Output

That’s all for the topic Display Armstrong Numbers in Java. If something is missing or you have something to share about the topic please write a comment.


You may also like

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.