文章
84
粉丝
408
获赞
33
访问
869.5k
#include<iostream>
#include<vector>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> vct;
for (int num = 2; num <= n; num++) {
int sum = 0;
for (int i = 1; i < num; i++) {
if (num%i == 0) {
vct.push_back(i);
sum += i;
}
}
if (sum == num) {
cout << num << " its fastors are";
for (int i = 0; i < vct.size(); i++)
cout << " " << vct[i];
cout << endl;
}
vct.clear();
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发