You are viewing a single comment's thread. Return to all comments →
c#
public static int divisors(int n)
{ int divisors = 0; if (n % 2 != 0) { return divisors; } else for (int i = 1; i <= Math.Floor(Math.Sqrt(n/2)); i++) { if ((n/2) % i == 0) { divisors++; if (i*i != n/2) { divisors++; } } } return divisors; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Divisors
You are viewing a single comment's thread. Return to all comments →
c#
public static int divisors(int n)