C-study/04/4/4.c

28 lines
373 B
C
Raw Normal View History

2021-11-04 16:59:48 +00:00
#include<stdio.h>
int is(int number){
int n,sum=0,old=number;
while(1){
n = number % 10;
sum += n * n * n;
number /= 10;
if(number==0)break;
}
if(old==sum)return 1;
else return 0;
}
int main(){
int m,n;
printf("Input m: ");
scanf("%d",&m);
printf("Input n: ");
scanf("%d",&n);
for(int i=m;i<=n;i++){
if(is(i))printf("\n%d",i);
}
return 0;
}