jsp第一次作业
1 <%@ page language="java" contentType="text/html; charset=utf-8" 2 pageEncoding="utf-8"%> 3 <!DOCTYPE html> 4 <html> 5 <head> 6 <meta charset="utf-8"> 7 <title>1-100素数之和</title> 8 </head> 9 <body> 10 <% 11 int i, j, sum = 0; 12 for (i = 1; i < 100; i++) { 13 for (j = 2; j < i; j++) { 14 if (i % j == 0) { 15 break; 16 } 17 } 18 if (j == i) { 19 sum += i; 20 } 21 } 22 %> 23 1-100之间的素数之和为: 24 <%=sum%> 25 </body> 26 </html>