Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Print out all prime number that are greater than or equal to lowerBound and less than or equal to upperBound I have entered in the

Print out all prime number that are greater than or equal to lowerBound and less than or equal to upperBound

I have entered in the skeleton function for generatePrimes at the botome of the code.

My main() will be documented as well.

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 CODE I HAVE SO FAR IS BELOW)

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#include #include

generatePrimes(int lowerBound, int upperBound){ //need help here }

int main ( int argc, char *argv[] ){ if(argc != 3) { printf("Only enter two integer arguments, please"); } else{ int lowerBound = atoi(argv[1]); int upperBound = atoi(argv[2]); generatePrimes(lowerBound, upperBound); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

Students also viewed these Databases questions