Armstrong Number Program
Please comment the code in the comments section, it will be added to this post.
Login/Signup to comment
Please comment the code in the comments section, it will be added to this post.
Login/Signup to comment
Get Hiring Updates right in your inbox from PrepInsta
int cube=0;
int rem =0;
int N; // number to be checked for armstrong.
int N1=N;
while(N!=0)
{
rem = N%10;
cube = cube+Math.pow(rem,3);
N=N/10;
}
if(cube == N1)
{
System.out.println(“Yes Armstrong number”);
}
else
{
System.out.println(“Not Armstrong number”);
}