输入
180
输出
2 2 3 3 5
质数概念,只能被本身和1整除,最小的质数是2
import
java.util.Scanner;
public
class
Main {
public
static
void
main(String[] args) {
Scanner scanner =
new
Scanner(System.in);
while
(scanner.hasNextLong()) {
long
num = scanner.nextLong();
long
t = num;
for
(
int
i=
2
;i<=t; i++) {
while
(num % i ==
0
) {
num = num/i;
System.out.print(i+
" "
);
}
}
}
}
}