class Armstrong
{
public static void main (String arrg[])
{
int a,b,c,d,f;
int n= Integer.parseInt (k[0]);
a=n%10;
b=n/10;
c=b%10;
d=b/10;
f=(a*a*a)+(c*c*c)+(d*d*d);
if (f==n)
{
System.out.println("the number is Armstrong");
}
else
{
System.out.println ("the number is not Armstrong");
}
}
{
public static void main (String arrg[])
{
int a,b,c,d,f;
int n= Integer.parseInt (k[0]);
a=n%10;
b=n/10;
c=b%10;
d=b/10;
f=(a*a*a)+(c*c*c)+(d*d*d);
if (f==n)
{
System.out.println("the number is Armstrong");
}
else
{
System.out.println ("the number is not Armstrong");
}
}
No comments:
Post a Comment