import java.util.Scanner;
public class Armstrong2
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int c=0,a,temp;
int n;
System.out.println("Enter any Integer value");
n=sc.nextInt();
temp=n;
while(n>0)
{
a=n%10;
n=n/10;
c=c+(a*a*a);
}
if(temp==c)
System.out.println("Armstrong number");
else
System.out.println("Not armstrong number");
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.