C++ program that display all the prime numbers between 2 and 1000
###### Posted by Samath
Last Updated: December 24, 2014

Develop a program to display all the prime numbers between 2 and 1,000, inclusive. Display eight prime numbers per line. Numbers are separated by exactly one space.

Solution:

```#include <iostream>

using namespace std;

int main()
{
int num, i, countFactors;
int countBreak = 0;

cout << "Prime numbers (1-1000) : " << endl;

for (num = 1; num <= 1000; num++)
{
countFactors = 0;

for (i = 2; i <= num; i++)
{
if (num % i == 0)
{
countFactors++;
}
}

if (countFactors == 1)
{
cout << num << " ";
countBreak++;

if(countBreak == 8)
{
cout<<endl;
countBreak = 0;
}
}
}
system("pause");
return 0;
}```

###### Find Prime numbers using Python
Samath | Mar 02, 2015
###### C++ Print First n Prime Numbers
Samath | Jan 05, 2017
###### C program that receives an integer number and determines if it is a prime number
Samath | Jun 01, 2015
###### 10001'st prime number using Python (Project Euler Problem 7 Solution)
Samath | Jan 11, 2017