偶做的第一题在WIN-TC上试过,不知道合不合要求 (第二题解释一下,偶看不懂)
#include<stdio.h>
#define N 1000
main()
{int i,j,k;
int a[N];
int sum=0,sum1=0,sum2=0;
k=1;
for(i=2;i<1000;i++)
{for(j=2;j<i;j++)
{if(i%j==0) break;}
if(i==j)
{a[k]=i;k++;}
}
printf("the smaller number of ten is;\n");
for(i=1;i<=10;i++)
{printf("%d
",a[i]);
sum1=sum1+a[i];
}
printf("\n");
printf("the bigger number of ten is:\n");
for(i=1;i<=10;i++)
{printf("%d
",a[k-i]);
sum2=sum2+a[k-i];
}
printf("\n");
printf("the totall smaller number of ten is %d\n",sum1);
printf("the tatall bigger number of ten is %d\n",sum2);
sum=sum1+sum2;
printf("the totall of two part is %d\n",sum);
getch();
}