求素数的问题,如何实现???????????????
--求 10-30的素数,下面的怎么不能实现呢???????????declare @num int ,@i int
set @num = 10
while @num <= 30
begin
set @i = 2
while @i<@num
begin
if @num% @i = 0 break
set @i = @i+1
---print @i
end
if @num>=@i print @num
set @num = @num+1
end
结果:
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
----------
郁闷啊
欢迎加入程序爱好者群64995665群,继续讨论.