实验四
#include <stdio.h>
/*void select_sort(int a[],int n)
{ for(int i=0; i<n-1; i++) {
int max_index = i;
for(int j=i+1; j<n; j++) {
if(a[j] > a[max_index])
{ max_index = j; } }
if( i != max_index)
{ int temp = a[i];
a[i] = a[max_index];
a[max_index] = temp; } } }
void main()
{ int a[10],i;
for(i=0;i<10;i++){
scanf("%d",&a[i]); }
select_sort(a,10);
for(i=9;i>=0;i--){
printf("%d ",a[i]); } }
{ int a[3][3],i,j,m=0,n=0;
for (i = 0; i < 3; ++i) {
for (j = 0; j < 3; ++j){ scanf("%d",&a[i][j]); } }
m=a[0][0]+a[1][1]+a[2][2];
n=a[0][2]+a[1][1]+a[2][0];
printf("%d\n%d\n",m,n); }
{ char a[9999];
int i,n=0;
gets(a);
for ( i = 0; i < 9999; i++) {
if (a[i]==' ') { n++; } } printf("%d\n",n+1); }*/
int main()
{ int n = 100;
int mark[101] = {1, 1}; int c; int j;
for (c = 2; c * c <= n; c++) {
if(mark[c] != 1){ for(j=2; j<=n/c; j++){mark[c*j]=1;} } }
for(c=2;c<=n;c++){
if(mark[c]!=1)
{printf("%d\n",c);} }
return 0; }