Guest User

Untitled

a guest
Jan 19th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. const unsigned nMax=999;
  7. unsigned int n, sum, div;
  8.  
  9. for (n=1;n<=nMax;n++){
  10. sum=0 ;
  11.  
  12. for (div=1;div<n;div++){
  13. if(n%div==0)
  14. sum+=div;
  15. }
  16. if (sum==n)
  17. printf("%u\n",n);
  18.  
  19. }
  20.  
  21. return 0;
  22. }
Add Comment
Please, Sign In to add comment