Advertisement
Istanvir389

perfcet

Aug 7th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int i ,num;
  5.  
  6. printf("Enter number ::");
  7. scanf("%d",&num);
  8. int sum=0;
  9. for(i=1;i<num; i++)
  10. {
  11. if(num%i==0)
  12. {
  13.  
  14. // printf("\n%d ",i);
  15. sum=sum+i ;
  16. }
  17. }
  18. //printf("\nSum is %d ",sum);
  19.  
  20. if(sum==num)
  21. {
  22. printf("\nThe number is perfect number ");
  23. }
  24. else
  25. printf("\nThis is not a perfect number");
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement