0

`I am having a problem trying to write a program that gets numbers from a selected file and returns each numbers sum of its perfect divisors. Could anyone give me a few pointers??`

```
#include <stdio.h> /* define fopen,fclose,fscanf,fprintf, EOF */
int sum_of_divisors(int num);
/* pre: Accepts the integer */
/* post: Returns the sum of its perfect divisors */
int main(void)
{
FILE *inp; /* input file pointer */
/* output file pointer */
int num; /* number read from the input file */
int factorial_value; /* value returned by the function */
inp = fopen("perfect.dat","r");
factorial_value = int sum_of_divisors(int num);
printf("The factorial value of the %d is %d",num,factorial_value);
return (0);
}
int sum_of_divisors(int num)
{
int sum = 0;
int i = 1;
for(i; i < num; i++){
if((num % i) == 0){
sum += i;
}
}
return (sum);
}
```