程序填空题:Sum of Prime Numbers
This program reads two intergers a and b from user's input, where `0
```Java
import java.util.stream.IntStream;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
if ( a<2 ) {
a=2;
}
System.out.println(
IntStream.range(a, b).
filter(@@[x->!IntStream.range(2, x).anyMatch(k->x%k==0)](5)).
sum()
);
in.close();
}
}
```
答案:
第1空:x->!IntStream.range(2, x).anyMatch(k->x%k==0)
```Java
import java.util.stream.IntStream;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
if ( a<2 ) {
a=2;
}
System.out.println(
IntStream.range(a, b).
filter(@@[x->!IntStream.range(2, x).anyMatch(k->x%k==0)](5)).
sum()
);
in.close();
}
}
```
答案:
第1空:x->!IntStream.range(2, x).anyMatch(k->x%k==0)