You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
425 B

#include<bits/stdc++.h>
using namespace std;
int cnt = 0;
bool isPerNum(int n) {
int sum = 0;
for (int i = 1; i < n; i++)
if (n % i == 0) sum += i;
if (sum == n) {
cnt++;
return true;
} else return false;
}
int main() {
int n;
cin >> n;
for (int i = 1; i < n; i++)
if (isPerNum(i))
cout << i << endl;
cout << "*" << cnt << endl;
return 0;
}