📅  最后修改于: 2022-03-11 14:52:19.248000             🧑  作者: Mango
public static void main(String[] args) {
int n=12;
for(int i=2; i<=n; i++){
while(n%i==0){
n=n/i;
System.out.println(i); //prints 2 2 3
}
}
}