Advertisement
Md_hosen_zisad

perfect

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