int main()
{
int r1,r2,t,sum,i,r,f=0,c=0;
printf("Enter Range=\n");
scanf("%d%d",&r1,&r2);
printf("Among Range Armstrong Numbers Are\n");
for(i=r1;i<=r2;i++)
{
t=i;
sum=0;
while(t!=0)
{
r=t%10;
sum=sum+r*r*r;
t=t/10;
}
if(i==sum)
{
printf("%d\n",i);
c++;
f=1;
}
}
printf("Total Armstrong Numbers=%d\n",c);
if(f!=1)
printf("Not Found In This Range\n");
return 0;
}
0 comments:
Post a Comment