public class Test {
public static void main(String[] args) {
int parm = 0;
System.out.println("请输入数字:");
Scanner scanner = new Scanner(System.in);
parm = scanner.nextInt();
System.out.print(parm + "=");
for (int i = 2; i <= parm; i++) {
while (parm != i) {
if (parm % i == 0) {
System.out.print(i + "*");
parm = parm / i;
} else {
break;
}
}
}
System.out.print(parm);
}
} |