public class Test1 {
public static void main(String[] args) {
int num = 1845;
int sum = 0;
System.out.println("因子:1");
sum += 1;
int sqrt = (int)Math.sqrt(num);
for(int i=2;iint j = num%i;
if(j==0){
System.out.println("因子:"+i);
sum += i;
int k = num/i;
System.out.println("因子:"+k);
sum += k;
}
}
System.out.println("因子和:"+sum);
}
}
http://zhidao.baidu.com/question/544468708.html?sort=6&old=1&afterAnswer=1#answer-1374498178