将任意数分解成质数的乘积算法实现
public static void main(String[] args) { fun(100); } public static void fun(int num){ int i=2; if(num==i){ System.out.println(num); return; }else{ while(true){ if(num%i==0){ System.out.print(i+"*"); fun(num/i); return; }else{ i++; if(i==num){ System.out.println(num); return; } } } } }