TextView text; int i,j; StringBuffer string = new StringBuffer(); for (i = 1; i < 1001; i++) { for (j = 2; j < i; j++) { if(i%j == 0){ break; } } if(i == j){ string.append(j+" "); text.setText(string); } }
1-100的素数
最新推荐文章于 2022-04-10 13:22:43 发布
TextView text; int i,j; StringBuffer string = new StringBuffer(); for (i = 1; i < 1001; i++) { for (j = 2; j < i; j++) { if(i%j == 0){ break; } } if(i == j){ string.append(j+" "); text.setText(string); } }