题解 | #牛牛的素数和#
牛牛的素数和
http://www.nowcoder.com/practice/d748d79f68ab443482c5547d93824f50
int main() {
int l, r, sum = 0, count = 0;
scanf("%d %d", &l, &r);
for (int i = l; i <= r; i++) {
for (int j = 1; j <= i; j++) {
if (i % j == 0) count++;
}
if (count == 2) sum += i;
count = 0;
}
printf("%d", sum);
return 0;
}