To be even more direct about the rareness of perfect numbers how about writing a function like this.

**Example:**

Code:

#include <stdio.h>
#include <ctype.h>

Include those two so that you can have your printf() and scanf() functions. You also need toupper() from ctype.h

Code:

const static long unsigned long perfect_numbers[] = {6, 28, 496, 8128, 33550336, 8589869056, 137438691328};

"But Matt, that doesn't seem like so many numbers!!! You are ruining my program."

That list constitutes all of the perfect numbers your computer will be able to safely comprehend without using GMP or something.

Code:

int is_perfect(long unsigned long value)
{
size_t i;
for(i = 0; i < sizeof(perfect_numbers)/sizeof(*perfect_numbers); ++i)
if(value == perfect_numbers[i])
return 1;
return 0;
}

All this function does is compares an input value (as a 64-bit value) to the list of known perfect numbers.

Code:

int main(void)
{
unsigned int n, i = 0;
while(toupper(i) != 'N')
{
do
{
fputs("> Please input a number: ", stdout);
} while(scanf("%d", &n) != 1);
for(i = 0; i < n; ++i)
if(is_perfect(i))
printf("** %d is perfect!! **\n", i);
fputs("> Continue? ", stdout);
i = getchar();
}
}

Make sense?