1. 26.
    +2
    #include <stdio.h>

    3. define LIMIT 100
    4. define PRIMES 25

    int main(){
    int i,j,numbers[LIMIT];
    int primes[PRIMES];


    for (i=0;i<LIMIT;i++){
    numbers[i]=i+2;
    }

    for (i=0;i<LIMIT;i++){
    if (numbers[i]!=-1){
    for (j=2*numbers[i]-2;j<LIMIT;j+=numbers[i])
    numbers[j]=-1;
    }
    }

    j = 0;
    for (i=0;i<LIMIT&&j<primes;i++)
    if (numbers[i]!=-1)
    primes[j++] = numbers[i];

    for (i=0;i<primes;i++)
    printf("%dn",primes[i]);

    return 0;
    }
    ···
   tümünü göster