## Write a C++ program to print all the prime numbers with in the given range

```#include<iostream>
#include<iomanip>
using namespace std;

int main(){
int num,i,count,n;
cout << "Enter max range: ";
cin >> n;
for(num = 1;num<=n;num++){
count = 0;
for(i=2;i<=num/2;i++){
if(num%i==0){
count++;
break;
}
}

if(count==0 && num!= 1)
cout << num << setw(3);
}
system("pause");
return 0;
}```

C++ program to find prime numbers in a given range

---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------

Program in C++ to find the prime number in given range
Write a C++ program to find prime numbers between 1 to 100
Prime numbers in a range - C++
Program to find the prime numbers between a given range
Write a program to print all the prime numbers with in the given range
C++ program to find prime numbers between two numbers
C++ program to find sum of prime numbers
C++ Program to Find Prime Numbers in a given Range

1. Good Job.....

Easiest Program for prime numbers...

Write A Program To How To Find Whether Given Number Is Prime Number Or Not

2. Easiest programme to create prime numbers.

3. very good programming jobs site www.fresherssoftwarejobs.in

4. very good programming jobs site www.fresherssoftwarejobs.in

5. Thank Yu so much sir ! Highly appreciated you for this effortt

6. Prime number program in C++

A prime number is a natural number which is greater than 1 and these numbers are only divisible by 1 and itself number. In programming point of view, we check condition number is divisible by other number or not except 1 and number itself. If number is not divisible by other number than that number is prime number.

7. C++ program to Find Largest Number among three numbers
Thanks for this code, it's very simple and easy.

8. http://techcpp.blogspot.in/2016/04/program-to-check-whether-given-number.html

9. To be honest this is not my solution. I wrote this from my head ;)
The time in which you get a solution, is incomparably shorter.

#include <array>
#include <chrono>
#include <cstdlib>
#include <iomanip>
#include <iostream>

int main(int count, char ** values) {
auto start = std::chrono::system_clock::now();

const std::size_t valueMax = 2000000;
std::array<bool, valueMax + 1> array;
array.fill(true);
for (std::size_t index = 1; index <= valueMax; ++index) {
if (!array[index]) {
continue;
}
// std::cout << index << ":";
if (index == 1) {
continue;
}
for (std::size_t x = index; x < array.size(); x += index) {
array[x] = false;
}
}

auto end = std::chrono::system_clock::now();
std::cout << "\n" << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
return EXIT_SUCCESS;
}