Advertisement
rdsedmundo

números perfeitos

Apr 29th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int soma_;
  6.     for(int i = 1; i <= 100; i++){
  7.         soma_ = 0;
  8.         for(int a = 1; a < i; a++ ) {
  9.             if(i%a==0) soma_ = soma_ + a;
  10.         }
  11.  
  12.         if(soma_ == i) printf("%i is um numero perfeito\n\n", i);
  13.     }
  14.  
  15.  
  16.     system("pause");
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement