Advertisement
GeeckoDev

ndiv

Aug 30th, 2011
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.17 KB | None | 0 0
  1. int nbDiviseurs(int n)
  2. {
  3.   int n_div = 0;
  4.   sqrt_n = sqrtf(n);
  5.    
  6.   for (i=2; i<=sqrt_n; i++)
  7.   {
  8.     if (n % i == 0) n_div += 1 + i!=n/i;
  9.   }
  10.  
  11.   return n_div;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement