forked from omonimus1/competitive-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprim1.cpp
More file actions
40 lines (37 loc) · 669 Bytes
/
prim1.cpp
File metadata and controls
40 lines (37 loc) · 669 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// https://www.codechef.com/problems/PRIME1
#include <iostream>
using namespace std;
bool isPrime(long long int n)
{
if(n <=1)
return false;
for(int i =2; i<n; i++)
{
if(n % i == 0)
return false;
}
return true;
}
void generate_primes()
{
long long int a, b;
cin >> a >> b;
if(a <=1 || b<=1)
return;
for(int i =a+1 ; i<b; i++)
{
if(isPrime(i))
cout<<i<<endl;
}
cout<<endl;
}
int main()
{
long long int test_cases;
cin >> test_cases;
while(test_cases--)
{
generate_primes();
}
return 0;
}