package 求质数
;
public class work1 {
public static void main(String
[] args
) {
System
.out
.println("求出1到100的质数");
for (int i
= 3; i
<=100 ; i
++) {
boolean f
= true;
for (int j
= 2; j
< i
; j
++) {
if(i
%j
==0){
f
=false;
break;
}
}
if(f
){
System
.out
.println("素数"+i
);
}
}
}
}
转载请注明原文地址:https://tech.qufami.com/read-19274.html