Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Rus");
- int N;
- int Sum;
- cout << "Найдите все совершенные числа до N " << endl;
- cout << "Введите число : " ;
- cin >> N;
- cout << " Совершенные числа :" << endl;
- for (int i = 1; i <= N; i++)
- {
- Sum = 0;
- for (int j = 1; j < i; j++)
- {
- if (i % j == 0)
- {
- Sum += j;
- }
- }
- if (Sum == i)
- {
- cout << i << " " << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement