直接上源码,看不懂评论区留言~
package taolun;
import java.util.Scanner;
public class fenjie {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
System.out.println("输入整数");
int a = input.nextInt();
input.close();
System.out.print(a+"=");
for (int i = 2; i <= a; i++) {
while (a%i==0) {
System.out.print(i);
a/=i;
if (a!=1) {
System.out.print("*");
}
}
}
}
}
没有回复内容