Advertisement
Guest User

loop

a guest
Apr 21st, 2018
50
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 n,a,b,i,j,sum;
  5.     scanf("%d",&n);
  6.     for(i=1; i<=n; i++)
  7.     {
  8.         scanf("%d",&a);
  9.         sum=0;
  10.         for(j=1; j<=a/2; j++)
  11.         {
  12.             if(a%j==0)
  13.             sum+=j;
  14.         }
  15.         if(sum==a){
  16.             printf("%d eh perfeito\n",a);
  17.         }
  18.         else{
  19.             printf("%d nao eh perfeito\n",a);
  20.         }
  21.  
  22.     }
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement