
class Armstrong
{
public static void main(String...s)
{
int m,n,i,j=0;
n=Integer.parseInt(s[0]);
m=n;
while(n!=0)
{
i=n%10;
j+=(i*i*i);
n/=10;
}
if(j==m)
System.out.println("
Number is armstrong");
else
System.out.println("
Number is not armstrong");
}
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.