We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f7a8cb3 commit a872466Copy full SHA for a872466
codechef/prim1.cpp
@@ -0,0 +1,40 @@
1
+// https://www.codechef.com/problems/PRIME1
2
+#include <iostream>
3
+using namespace std;
4
+
5
+bool isPrime(long long int n)
6
+{
7
+ if(n <=1)
8
+ return false;
9
+ for(int i =2; i<n; i++)
10
+ {
11
+ if(n % i == 0)
12
13
+ }
14
+ return true;
15
+}
16
17
+void generate_primes()
18
19
+ long long int a, b;
20
+ cin >> a >> b;
21
+ if(a <=1 || b<=1)
22
+ return;
23
+ for(int i =a+1 ; i<b; i++)
24
25
+ if(isPrime(i))
26
+ cout<<i<<endl;
27
28
+ cout<<endl;
29
30
31
+int main()
32
33
+ long long int test_cases;
34
+ cin >> test_cases;
35
+ while(test_cases--)
36
37
+ generate_primes();
38
39
+ return 0;
40
0 commit comments