package a; import java.util.*; public class Fenjiezhiyinshu { public static void main(String[] args) { System.out.println("输入一个正整数:"); Scanner a=new Scanner(System.in); int m=a.nextInt(); int k=2; if(m==1) { System.out.println("输入的数为m="+m); } else { System.out.print(m+"="); while (k <= m) { if (k == m) { System.out.print(m); break; } else if (m % k == 0) { System.out.print(k + "*"); m = m / k; } else { k++; } } } } }
时间: 2024-10-05 02:15:38