I wrote a function to find the sum of divisors for a number n.
int divisor_sum(long n) {
long sum = 0;
for (int a=1, a<=n, a++) {
if n % a == 0 {
sum = sum + a;
}
}
return sum;
}
Unfortunately, the program (which includes a main function skeleton) won't compile because it says that "'n' was not declared in this scope." I've tried declaring n as a long before and after the function definition statement to no avail. How do I fix this? Thanks