|
- #include<stdio.h>
- main()
- {
- int k[10],a,i,n=0,s;
- for(a=2;a<=1000;a++)
- {
- s=a;
- for(i=1;i<=a;i++)
- if( (a%i)==0 )
- {
- n++;
- s=s-i;
- k[n]=i;
- }
- if(s==0)
- { printf("\n%d is a wangshu,it is :",a);
- for(i=1;i<n;i++)
- printf("%d,",k[i]);
- printf("%d\n",k[n]);
- }
- }
- }
复制代码 |
|