69,373
社区成员
发帖
与我相关
我的任务
分享
int a,b,c,i;
for(i=100;i<1000;i++)
{
a=i/100;
b=(i/10)%10;
c=i%10;
if(a*a*a+b*b*b+c*c*c==i)
printf("%d\n",i);
}
#include <stdio.h>
void doit(int st,int ed)
{
int a,b,c;
for(int i=st;i<ed;i++)
{
a=i/100;
b=i%100/10;
c=i%10;
if(i==a*a*a+b*b*b+c*c*c)
{
printf("%d\n",i);
}
}
}
void main()
{
doit(100,999);
}