[Java] 纯文本查看 复制代码
int num = 900;
int one = 1;
StringBuffer sb = new StringBuffer(num + "=");
while(true) {
if (num == one) {
break;
}
one++;
while(num % one == 0) {
sb.append(one + "*");
num = num / one;
one = 1;
break;
}
}
System.out.println(sb.substring(0, sb.length() -1 ));
|