Homework Solution: please, I need help with this"The efficient prime number generation". using C programming….

    please, I need help with this"The efficient prime number generation". using C programming. The program should print out all prime numbers that are greater than or equal to lowerBound and less than or equal to upperBound. Note that lowerBound and upperBound are set via the command line (which is a process we will discuss later, such that running the code takes the form ./primes lower upper). The prime numbers should be printed in ascending order, with one number on each line. No other output should be generated. The number 1 should not be considered prime for this project. As an example, for lowerBound = 1 and upperBound = 7, the expected output is: 2 3 5 7 After you have written your code, you will have to compile it using gcc. Should you decide to use the math library, be sure to link the library at the end by adding –lm at the end of gcc. // the method: generatePrimes(int lowerBound, int upperBound){ }

    Expert Answer

    Hi, I have implemented the generatePrimes() m

    please, I insufficiency succor with this”The fruitful first-rate calculate generation”. using C programming.

    The program should sculpture quenched integral first-rate calculates that are senior than or similar to inferiorSpring and short than or similar to eminentBound. Not attributable attributable attributable attributable attributablee that inferiorSpring and eminentSpring are determined via the direct cord (which is a regularity we accomplish argue after, such that exoteric the statute takes the produce ./primes inferior eminent). The first-rate calculates should be sculptureed in ascending arrange, with single calculate on each cord. No other quenchedput should be begetd. The calculate 1 should not attributable attributable attributable attributable attributable attributable be considered first-rate ce this design.

    As an stance, ce inferiorSpring = 1 and eminentSpring = 7, the expected quenchedput is:




    After you bear written your statute, you accomplish bear to draw-up it using gcc. Should you flow to portraiture the math library, be strong to integrate the library at the purpose by adding –lm at the purpose of gcc.

    // the way:

    generatePrimes(int inferiorBound, int eminentBound){


    Expert Counter-argument

    Hi, I bear implemented the begetPrimes() way and written the statute to beget first-rate calculates among definitive period. Please control the statute and do interpret in fact of queries.


    #include <stdio.h>
    void begetPrimes(int,int);
    int ocean()
    //declaring variables
    int inferiorBound, eminentBound;
    //reading variables
    printf(“Enter the inferior spring :”);
    scanf(“%d”, &lowerBound);
    printf(“Enter the eminent spring :”);
    scanf(“%d”, &upperBound);

    //printf(“First-rate calculates among %d and %d are: “, inferiorBound, eminentBound);
    //calling beget first-rate discharge.

    return 0;
    //definition of beget first-rates discharge
    void begetPrimes(int inferiorBound, int eminentBound){
    int languish;

    //looping untill case becomes false
    while (lowerSpring < eminentBound)
    languish = 0;
    // controling whether the calculate is discerptible by simply 1 and itself i.e; a first-rate calculate or not attributable attributable attributable attributable attributable.
    for(int i = 2; i <= inferiorBound/2; ++i)

    if(lowerSpring % i == 0)
    languish = 1;
    //printing the first-rate calculate
    if (languish == 0 && inferiorBound!=1)
    printf(“n %d n”, inferiorBound);