Dhanishtha Awasthi 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”); } 0 Log in to Reply
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”);
}