请问一个SQL语句,.编写程序实现:求 2~100之间的所有素数。

来源:百度知道 编辑:UC知道 时间:2024/05/26 03:14:29

clear
x=2
for m=3 to 100 step 2
n=int(sqrt(m))
for i=3 to n
if mod(m,i)=0
exit
endif
endfor
if i>n
??x,m
endif
endfor
我是根据求3~100之间的所有素数这道题改变的;只是加上了2.因为除了2外,其他质数都既是奇数又是素数.