Polnochniy

Untitled

Nov 6th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. int main()
  5. {
  6. setlocale(LC_ALL, "Rus");
  7. int N, i;
  8. int Sum = 0;
  9. cout << "Введите число N " << endl ;
  10. cin >> N;
  11. for (i = 1; i < N; i++)
  12. {
  13. if (N % i == 0)
  14. {
  15. Sum += i;
  16. }
  17.  
  18. }
  19. if (Sum == N)
  20. {
  21. cout << "Да. Это число совершенное " << endl;
  22. }
  23. else
  24. {
  25. cout << "Нет . Это число не совершенное" << endl;
  26. }
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment