1.计算1~100素数之和
<% int sum1 = 0; for (int m = 2; m <= 100; m++) { int x = 0; for (int n = 2; n < m; n++) { if (m % n == 0) { x++; } } if (x == 0) { sum1+= m; } } %> <%=sum1 %>
2.计算1~100偶数之和
<% int sum = 0; %> <% for (int a = 0; a < 101; a += 2) { sum += a; } %> <%=sum%><br>