Home > Back-end >  Soft test application technology in the first half of 2018 the first topic for teachers to give corr
Soft test application technology in the first half of 2018 the first topic for teachers to give corr

Time:11-26

If a natural number N equals it all of the different real factors (namely a few of N and 1, but does not include N) the sum of the S, says the number for the "perfect number", such as 6=1 + 2 + 3 p=1 + 2 + 4 + 7 + 14, so 6 and 28 are perfect, obviously, 6 is 1 (minimal) perfect Numbers,

# include & lt; Stdio. H>
Int main ()
{
Int n, k, s=1;
For (n=6; n<=500; N++)
{
For (k=2; k<=n/2; K++)
{
If (n % k==0)
{
S=s + k;
}
If (n=s)
{
Printf (" perfect number is % d \ n ", n);
}
}
}
return 0;
}
Please the great god given the perfect number are correct code, thank you.
  • Related