"C language programming 365 cases of classic" 019

IT / Internet job recruitment plan -AT Bao brother


Depth understanding of IT / Internet industry and jobs, please refer to the general IT / Internet job recruitment program (the latest full version of Kong) .
Depth understanding of career advancement and learning routes, see the optimal path for career advancement courses and study guides (the latest full-stack version) .


Content navigation :

  • 1, title
  • 2, analysis
  • 3, code implementation
  • 4, operating results

1, title

If a number is exactly equal to the sum of its factors, this number is called "count them." E.g. 6 = 1 + 2 + 3. After programming to find all the numbers less than 1000.


2, analysis

If a number is exactly equal to the sum of its factors, called the number "perfect number." Each less than its divisors (true about the number, the number of listed about a number, remove the number itself, and the rest is that it's really about the number) and a natural number of its own called the perfect number (Perfect number), and said the number of perfect or complete number.

For example: The first is a perfect number 6, it is about the number 1,2,3,6, 6 is removed outside itself, adding the number of the remaining 3, 1 + 2 + 3 = 6. The second number is the 28 completely, it is about several 1,2,4,7,14,28, 28 itself is removed, the remaining number of the sum 5, 1 + 2 + 4 + 7 + 14 = 28. The third perfect number is 496, the number of 1,2,4,8,16,31,62,124,248,496 about, except

Guess you like

Origin blog.csdn.net/goldentec/article/details/105283222