标签:
1 #include <iostream> 2 using namespace std; 3 int main() 4 {int m,s,i,n; 5 cin>>n; 6 for (m=2;m<n;m++) 7 {s=0; 8 for (i=1;i<m;i++) 9 if ((m%i)==0) s=s+i; 10 if(s==m) 11 {cout<<m<<" "<<"its factors are"<<" "; 12 for (i=1;i<m;i++) 13 if (m%i==0) cout<<i<<" "; 14 cout<<endl; 15 } 16 } 17 return 0; 18 }
标签:
原文地址:http://www.cnblogs.com/wangmengmeng/p/4542560.html