Computer Science, asked by Nabilariaz, 1 year ago

write Java program to input a number use function int Armstrong (int n) to receive the number the function returns 1 if number is Armstrong, otherwise 0

Answers

Answered by pasrichanangal
39
class check
{
int Armstrong(int n)
{
int a,r,z;a=r=z=0;
while(n>0)
{
a=n%10;
r=r+a*a*a;
n=n/10;
}
if(r==z)
return(1);
else
return(0);
}
}

It's from APC
Attachments:
Similar questions