class Text3_For {
public static void main(String[] args) {
//统计所有水仙花数的个数
int count =0;
for (int i = 100;i <= 999 ;i++ ) {
int ge = i % 10;
int shi = i / 10 % 10;
int bai = i / 10 / 10 % 10;
if (ge * ge * ge + shi * shi * shi + bai * bai * bai == i) {
System.out.println(i);
count=count++; //满足条件就自增,计数器思想
}
}
System.out.println("count = " + count);
}
}
上面count 自增,可以将其自增值再赋于count吗?编译的时候没出错,但运行的结果count居然是0,这个有所能帮忙解答下,谢谢!!