Here is the final code for my program, which seems to work fine.
Code:
/*write a program which accepts as input an integer (which must be 2 or greater)
and prints out its proper divisors in ascending order, and the sum of its pro-
per divisors. The program should also report whether the input number is per-
fect or not.*/
#include <stdio.h>
int main ( void )
{
int n, d = 1, s = 0;
printf("Enter a number greater than two:\t");
scanf("%d", &n);
getchar ();
printf("The proper divisor(s) of %d is:\n", n);
while ( d < n ){
if ( n % d == 0 ){
s = d + s;
printf("%d\t", d);
}
d++;
}
printf("\nThe sum of the divisors is %d.\n", s);
if ( n == s )
printf("%d is a perfect number.\n", n);
else
printf("%d is not a perfect number.\n", n);
getchar();
return 0;
}