write a program to find the Amstrong Number in java
import java.util.*;
public class AmstrongNum {
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
int n,r,d=0,temp;
System.out.println("enter a number");
n=s.nextInt();
temp=n;
while(n!=0)
{
r=n%10;
d=d*d*d+r;
n=n/10;
}
if(temp==d)
System.out.println("amstrong number");
else
System.out.println(" not amstrong");
}
}