习题2_1水仙花数
package 第二章习题;
public class 习题2_1水仙花数{
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i=100;i<=999;i++) {
int a=i/100;
int b=(i/10)%10;
int c=i%10;
if(i==a*a*a+b*b*b+c*c*c) {
System.out.println(i);
}
}
}
}
public class 习题2_1水仙花数{
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i=100;i<=999;i++) {
int a=i/100;
int b=(i/10)%10;
int c=i%10;
if(i==a*a*a+b*b*b+c*c*c) {
System.out.println(i);
}
}
}
}