- #include <stdio.h>
- void main()
- {
- int a ,i,b,n;
- for (a=1;a<100;a++)
- {
- for (b=0,i=1;i<=a/2;i++)
- {
- if (!(a%i))
- b+=i;
- for (n=0,i=1;i<=b/2;i++)
- if (!(b%i))
- n+=i;
- }
- if (n==a&&a<b)
- printf("%4d %4d\\n",a,b);
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/060620149724.html
来源: http://www.codesnippet.cn/detail/060620149724.html