<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <body> <% int i, j, sum = 0; for (i = 1; i < 100; i++) { for (j = 2; j < i; j++) { if (i % j == 0) { break; } } if (j == i) { sum += i; } } %> 1-100的素数之和为: <%=sum%> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <body> <% int i, j, sum = 0; for (i = 1; i < 100; i++) { for (j = 2; j < i; j++) { if (i % j == 0) { break; } } if (j == i) { sum += i; } } %> 1-100的素数之和为: <%=sum%> </body> </html>