OK 直接上代码 C++复制void calc(int x){ for(int i=2;i<=x/i;i++){ while(x%i==0){ cout<<i<<" "; x/=i; } } if(x>1)cout<<x; }