Java代码:
import java
.util
.Scanner
;
public class rrr {
public static void fenjie(int n
) {
for (int i
=2;i
<=n
;i
++) {
if (i
== n
) {
System
.out
.print(i
);
return;
}
if (n
> i
&& (n
% i
== 0)) {
System
.out
.print(i
+"*");
fenjie(n
/ i
);
break;
}
}
}
public static void main(String
[] args
) {
Scanner input
= new Scanner(System
.in
);
int n
= input
.nextInt();
fenjie(n
);
}
}
运行结果:
转载请注明原文地址:https://tech.qufami.com/read-19390.html