解题思路:首先要知道素数的定义然后通过循环便历
public
class
ZhiShu{
public
static
void
main(String[] args){
for
(
int
i =
101
;i <=
200
;i ++){
if
(ss(i)){
System.out.println(i);
}
}
}
public
static
boolean
ss(
int
a){
//判断是否为质数
for
(
int
i =
2
;i <= Math.sqrt(a);i ++){
if
(a % i ==
0
){
return
false
;
}
}
return
true
;
}
}
|