1 回答
慕勒0069038
TA贡献143条经验 获得超39个赞
package t;
import java.util.ArrayList;
import java.util.List;
public class main {
static List sushu(int a,int b){
List<Integer> li = new ArrayList<Integer>();
for( ; a<=b; a++){
boolean isSushu = true;
for(int i = 2; i < a ; i++ ){
if( a%i == 0){
isSushu = false;
break;
}
}
if(isSushu)
li.add(a);
}
return li;
}
public static void main(String[] args){
System.out.println(main.sushu(1, 100));
}
}
添加回答
举报
0/150
提交
取消