Reference no: EM13936629
Prime Numbers?
You are to find all the prime numbers between 90,000 and 100,000 and print them out.
One way to do this (the way you will have to do this) is fill an array with the values from 1 to 100,000. Start with 2 and go thru the array and every 2nd location in the array zero it out. You just eliminated any value that is divisible by 2. Now move to the next value (after 2) which will be 3, and go thru the array and zero out every 3rd location of the array. You just eliminated any number divisible by 3. Now move to the next location after 3 which is 4, and you see it is zero. Skip it because you have eliminated all multiples of 4 by eliminating multiples of 2. So move to the next (5) and eliminate multiples of 5. (Be sure not to zero out the 2,3 and 5 etc since they are prime numbers, just their multiples.) So if the next location is not 0, then traverse through the array and eliminate its multiples. Do this for the entire array.
You do not have to loop from 1 to 100,000. Find what value you can stop at in this algorithm which is much less than 100,000.
Print out the nonzero values in the array and that will be the prime numbers. Print out the numbers 7 per line and make sure they line up on the last digit. (setw(8)???)
You are to use an array for the data and use pointers to move through the array to solve this problem. The only place to use the [ ] is in the declaration, no [ ] syntax in any other code in the program.
Attachment:- prime.cpp
What is the number of observations used for each variable
: State your conclusions relative to the assumptions. What is the number of observations used for each variable? How did you handle missing data? What is the value of the Pearson correlation coefficient between these two variables? In SPSS, useAnalyze..
|
Managed or developed in a global context
: The purpose of the project is to apply the knowledge and techniques you learn from this class to study real world problems. You will need to research a specific topic in the context of global IT management And write a 6 page paper.
|
Find potential hazards that impact stability of ecosystem
: Identify the structure and function of the main organs in at least two of the organisms found in your selected ecosystem, and indicate why they are best suited for that environment.
|
Future of professional communication
: Your blog should respond (in total) to any four of these headings: • The future of professional communication.
|
Find all the prime numbers between 90,000 and 100,000
: Print out the nonzero values in the array and that will be the prime numbers. Print out the numbers 7 per line and make sure they line up on the last digit. (setw(8)???)
|
Evaluate the pirellis performance
: Calculate Pirelli's bonus for 2008. Evaluate Pirelli's performance. Did he do as good a job as the numbers in requirement 1 suggest? Explain.
|
With the latest threats and security issues
: Security professionals need to ensure that they keep up to date with the latest threats and security issues. This allows them to update their risk profiles, such as identifying if their systems are vulnerable.
|
What leading primary producers and top consumers ecosystem
: What are the consequences if all individuals belonging to one of these key species are removed? (Choose one specific example and describe the impact on other organisms in the ecosystem as well as on the abiotic environment.)
|
Calculates and displays the body mass index
: Write a Java application that calculates and displays the body mass index (BMI) for N people. N should be declared as a constant and should be equal to the largest digit of your student id number
|