0

```
I am trying to develop a program that reads a list of integers from a file and outputs whether or not each integer in the file is perfect. Its suppose to give practice using endfile-controlled and for loops. The input file of numbers i have created are :
456
18
30642
8128
109
81
496
2412
11213
830
4253
7
```

```
#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 */
*outp; /* output file pointer */
int num; /* number read from the input file */
int factorial_value; /* value returned by the function */
inp = fopen("perfect.dat","r");
outp = fopen("results.dat","w");
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;
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);
}
```