jsp第一次作业
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>素数和</title> </head> <body> 1-100素数的和为: <% int i; int sum = 0; boolean flag = true; for (i = 2; i <= 100; i++) { flag = true; for (int j = 2; j < i; j++) { if (i % j == 0) { flag = false; break; } } if (flag) { sum += i; } } %> <%=sum %> </body> </html>