#include<stdio.h>intfactorsum(int number );voidPrintPN(int m,int n );intmain(){int m, n;scanf("%d %d",&m,&n);if(factorsum(m)== m )printf("%d is a perfect number\n", m);if(factorsum(n)== n )printf("%d is a perfect number\n", n);PrintPN(m, n);return0;}/* 你的代码将被嵌在这里 */
intfactorsum(int number){int i;int sum =0;for(i =1; i < number; i++){if(number%i ==0){
sum += i;}}return sum;}voidPrintPN(int m,int n){int i, ret;int flag =0;for(i = m; i <= n; i++){if(factorsum(i)== i){int a[20], count =0;
flag =1;
printf ("%d = ", i);for(ret =1; ret < i; ret++){if(i%ret ==0){
a[count]= ret;
count ++;}}for(ret =0; ret < count; ret++){
printf ("%d", a[ret]);if(ret != count-1){
printf (" + ");}}
printf ("\n");}}if(flag ==0){
printf ("No perfect number");}}