Thread: Sieve of Eratosthenes

  1. #1
    Registered User
    Join Date
    Oct 2018
    Posts
    4

    Sieve of Eratosthenes

    Hello,

    I have some trouble figuring out the code for the sieving of prime numbers. Some help would be appreciated.

    The function print_prim prints the numbers from the array and lese_int is the scan function.

    Function of print_prim :

    Code:
    void print_prim(int *array, int laenge) {    for (int i=0; i<laenge; i++) {
            if (array[i] == 1) {
                printf("%d, ", i+2);
            }
        }
        printf("\n");
    }
    E: My code is in the .txt file

    Sieb des Eratosthenes.txt
    ckurs_blatt06_aufgabe01_vorgabe.cckurs_blatt06_aufgabe01_vorgabe.c

  2. #2
    Registered User
    Join Date
    Oct 2018
    Posts
    4
    Nvm, found the problem.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sieve of Eratosthenes
    By Hodor in forum C Programming
    Replies: 9
    Last Post: 11-27-2013, 02:16 AM
  2. Sieve of Eratosthenes
    By Eman in forum C++ Programming
    Replies: 26
    Last Post: 01-26-2011, 05:23 AM
  3. Sieve of Eratosthenes
    By darren78 in forum C++ Programming
    Replies: 0
    Last Post: 04-28-2010, 10:52 AM
  4. Sieve of Eratosthenes
    By jack_carver in forum C++ Programming
    Replies: 7
    Last Post: 04-13-2010, 10:33 PM
  5. Primes with Sieve of Eratosthenes.
    By opciok95 in forum C Programming
    Replies: 20
    Last Post: 11-15-2005, 11:03 AM

Tags for this Thread