【題目敘述】https://zerojudge.tw/ShowProblem?problemid=a121
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int a, b, n_prime;
bool isPrime;
while (cin >> a >> b) {
n_prime = 0;
if (a <= 1)
a = 2;
if (b < a){
cout << n_prime << endl;
continue;
}
for (int i=a; i<=b; i++) {
isPrime = true;
for (int j=2; j<=sqrt(i); j++) {
if (i % j == 0) {
isPrime = false;
break;
}
}
if (isPrime)
n_prime++;
}
cout << n_prime << endl;
}
}