java 求100 以内素数的和
作者:互联网
package com.oop;
public class IsPrime {
public static void main(String[] args) {
int sum = 0,i,j;
for( i = 2; i <= 100;i++) {
for( j = 2; j < i;j++) {
if(i % j == 0) break;
}
if(j == i) {
sum += i;
}
}
System.out.println(sum);
}
}
标签:java,String,package,void,public,素数,IsPrime,100 来源: https://www.cnblogs.com/my-blog-site/p/16392073.html