其他分享
首页 > 其他分享> > 穷举法求因子

穷举法求因子

作者:互联网

#include<iostream>
using namespace std;
int main()
{
    int n;
    cout<<"输入n值";
    cin>>n;
    cout<<"Number"<<n<<"Factor";
    for(int i = 1;i<=n;i++)
        if(n%i == 0)
            cout<<i<<" ";
        return 0;

}
输入n值36
Number36Factor1 2 3 4 6 9 12 18 36
Process returned 0 (0x0)   execution time : 2.946 s
Press any key to continue.

标签:cout,穷举法,int,0x0,36,因子,any
来源: https://blog.csdn.net/m0_46644419/article/details/118864051