码迷,mamicode.com
首页 > 编程语言 > 详细

java打印1000内的质数并用表格输出

时间:2018-06-07 14:14:30      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:分享图片   info   .com   打印   order   out   tab   width   技术分享   

<table width=‘500‘ border=‘1‘>
<%
int c=1;
for(int i=2;i<=1000;i++){
int n=0;
for(int j=2;j<i;j++){
if(i%j==0){
n++;
break;
}
}
if(n==0){
if(c%10==0){  
out.println("<td>"+i+"</td>");
out.println("<tr>");
c++;
}else{
out.println("<td>"+i+"</td>");
c++;
}
}
}
%>
</table>

效果如下:

技术分享图片

 

java打印1000内的质数并用表格输出

标签:分享图片   info   .com   打印   order   out   tab   width   技术分享   

原文地址:https://www.cnblogs.com/zym2000/p/9149720.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!