Kimossab

Numeros Perfeitos

Jan 9th, 2014
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.15 KB | None | 0 0
  1. bool perfeito(int n)
  2. {
  3.     int i, soma=0;
  4.     for(i=n-1; i>0; i--)
  5.     {
  6.         if(n%i == 0)
  7.             soma += i;
  8.     }
  9.     if(soma == n)
  10.         return true;
  11.     else return false;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment