Purchase Solution

Programming Using C++

Not what you're looking for?

Ask Custom Question

Please help with the following problem.

Write a program that computes and prints the 1000th prime number using code blocks c++.

a. You will need some variables to keep track of which prime number you're on and keep track of where you are in your loop.
b. Need to test odd numbers to see if they are prime..
c. Need two loops

Purchase this Solution

Solution Summary

This problem helps write a program that computes and prints the 1000th prime number using code blocks c++. The code includes variables to keep track of which prime number you're on and where you are in your loop. It also allows testing odd numbers to see if they are prime, and includes two loops. The codes are given in an attachment and in the online posting.

Solution Preview

See attached file for the solution.

When you start the program, it asks "which prime number?" If you want 1000th prime number, type 1000 and press enter key. The code actually finds all the prime numbers up to n-th prime number. So if you type in 1000, it will find all the 1000 prime numbers and return only 1000th prime ...

Purchase this Solution


Free BrainMass Quizzes
Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.