- 0
Notifications Mark All Read
- Login
- Get Prime
Armstrong Number Program
Please comment the code in the comments section, it will be added to this post.
Notifications Mark All Read
Please comment the code in the comments section, it will be added to this post.
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”);
}