Site icon C Dersleri

C ile Tam Bölenlerin Toplamı

//returns the sum of the exact divisors of n
int sumDivisors(int n) {
 int sumDiv = 1;
 for (int h = 2; h <= n / 2; h++)
 if (n % h == 0) sumDiv += h;
 return sumDiv;
} //end sumDivisors
Exit mobile version