You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
int cnt;
|
|
bool isPrime(int x) {
|
|
for (int i = 2; i <= sqrt(x); i++)
|
|
if (x % i == 0) return false;
|
|
return true;
|
|
}
|
|
int main() {
|
|
int n, m;
|
|
cin >> n >> m;
|
|
for (int i = n; i <= m; i++)
|
|
if (isPrime(i)) cnt++;
|
|
|
|
cout << cnt << endl;
|
|
return 0;
|
|
} |