Armstrong Number Program in Java

Armstrong Number Program in Java

In this program, you will understand and get the code of simple Armstrong number program in java.

An Armstrong number is a number that is equal to the sum of its own digits when each digit is raised to the power of the number of digits in the number.

For example:

153 is an Armstrong number because 1^3 + 5^3 + 3^3 = 153.

Example of Armstrong Number Program in Java

Output

C:\CodeRevise\java>javac ArmstrongNumber.java

C:\CodeRevise\java>java ArmstrongNumber
Enter a number :
153
153 is an Armstrong number

C:\CodeRevise\java>java ArmstrongNumber
Enter a number :
125
125 is not an Armstrong number

 

 

 

Check out our other Java Programming Examples

 

 

 

 

Leave a Comment

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

Scroll to Top