wap to check and print armstrong no.s by users
Answers
Answered by
2
class ___
{
psvm()
{
int N, temp,r,cu,sum=0,
Sopln("enter the no. to be checked");
N=......................;
temp=N;
while(N!=0)
{
r=N%10;
cu=r*r*r;
sum=sum+cu;
N=N/10;
}
if (temp==sum)
{
sopln("Yes");
}
else
{
sopln("no");
}
}
}
I guess its right.
Hope this helps you
{
psvm()
{
int N, temp,r,cu,sum=0,
Sopln("enter the no. to be checked");
N=......................;
temp=N;
while(N!=0)
{
r=N%10;
cu=r*r*r;
sum=sum+cu;
N=N/10;
}
if (temp==sum)
{
sopln("Yes");
}
else
{
sopln("no");
}
}
}
I guess its right.
Hope this helps you
Similar questions