3.3jsp作业
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Insert title here</title> </head> <body> 1-100之间的素数和为: <% int sum=0; boolean flag=true; for(int 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>