C++ —— 求因子


 

 

 

代碼如下:

 1 #include <iostream>
 2 using namespace std;
 3 int main()
 4 {
 5     int a;
 6     cin>>a;
 7     for(int b=1;b<=a;b++)
 8     {
 9         if(a%b==0) cout<<b<<" ";
10      } 
11     return 0;
12 }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM