Below is a program ive written to test if a number entered is a perfect number. However im having problems with making another function that will lists the perfect numbers from 1 to 1000. Any help or hints will be appreciated. Thanks

Code:#include <stdio.h> int factors( int ); int perfect( int ); int main() { int number; printf("Enter Number: " ); scanf( "%d", &number ); printf( "%d\n", perfect( number ) ); return 0; } int factors( number ) { int counter = 1, counter2 = 0, newNumber; while ( counter <= number ) { if ( ( number % counter == 0 ) && ( number != counter ) ) { newNumber = counter; counter2 += newNumber; } counter++; } return counter2; } int perfect( number ) { if ( number == factors( number )) return 1; else return 0; }