Advertisement
sathi_talukder

Untitled

Feb 24th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int i, num, sum = 0;
  6. scanf("%d", &num);
  7. for(i=1; i<num; i++)
  8. {
  9.  
  10. if(num%i == 0)
  11. {
  12. sum += i;
  13. }
  14. }
  15.  
  16. if(sum == num)
  17. {
  18. printf("%d is PERFECT NUMBER", num);
  19. }
  20. else
  21. {
  22. printf("%d is NOT PERFECT NUMBER", num);
  23. }
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement