Advertisement
Guest User

#64 NumarPerfect

a guest
Feb 17th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int d, x, s, ct = 0;
  4. int
  5. main ()
  6. {
  7. cin >> x;
  8. s = 0;
  9. for (d = 1; d * d < x; d++)
  10. if (x % d == 0)
  11. s = s + d + x / d;
  12. if (d * d == x)
  13. s = s + d;
  14. if (s - x == x)
  15. cout << x << " este perfect";
  16. else
  17. cout << x << " nu este perfect";
  18.  
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement