ValerianBenchea

Functie eficienta pt numarul de divizori

Oct 13th, 2022
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.15 KB | None | 0 0
  1. int nrdiv(int n)
  2. {
  3. int nr=2, d;
  4. for(d=2; d*d<n; d++)
  5. {
  6. if(n%d==0)
  7. nr+=2;
  8. }
  9. if(d*d==n)nr++;
  10. return nr;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment