check number is armstrong

//Enter one number and check it is armstrong no or not
#include
#include
void main()
{
int no,i,r=0,d;
clrscr();
printf("\n Enter The No :- ");
scanf("%d",&no);
while(no>0)
{
d=no%10;
no=no/10;
r=r+(d*d*d);
}
if(r==0)
{
printf("\n No is Armstrong");
}
else
{
printf("\n No Is Not Armstrong");
}
getch();
}

0 comments:

Post a Comment