Files
python/C++专题课程/基础知识/水仙花数第二版本.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

36 lines
430 B
C++

#include<bits/stdc++.h>
using namespace std;
int fun(int n) {
int b=n/100;
int s=n/10%10;
int g=n%10;
int sum=b*b*b+s*s*s+g*g*g;
if(sum==n)
return 1;
else
return 0;
}
int main() {
int n=1210;
do
{
cout<<n%10<<endl;;
n/=10;
}
while(n!=0);
// int start=100,stop=380;
// for(int i=start; i<=stop; i++) {
// if(fun(i)==1) {
// printf("%d ",i);
// }
// }
return 0;
}