Share your repls and programming experiences

← Back to all posts
Disclaimer Java program to find Armstrong number using while loop
RaghunathThilag (1)

Java program to find Armstrong number using while loop. In the java programming language, check whether the number is an armstrong number or not. This software will determine whether or not the number is an armstrong number. To print the armstrong number in the output of a java program for beginners.

class Main
{
public static void main(String[] args)
{
int d=0,arm,temp;
int n=154;
temp=n;
while(n>0)
{
arm=n%10;
n=n/10;
d=d+(armarmarm);
}
if(temp==d)
System.out.println("armstrong number");
else
System.out.println("Not armstrong number");
}
}

Output:

154 Not armstrong number

Link: https://inlarn.com/java-program-to-find-armstrong-number-using-while-loop/