Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int i ,num;
- printf("Enter number ::");
- scanf("%d",&num);
- int sum=0;
- for(i=1;i<num; i++)
- {
- if(num%i==0)
- {
- // printf("\n%d ",i);
- sum=sum+i ;
- }
- }
- //printf("\nSum is %d ",sum);
- if(sum==num)
- {
- printf("\nThe number is perfect number ");
- }
- else
- printf("\nThis is not a perfect number");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement