发布网友 发布时间:2022-04-24 03:23
共2个回答
热心网友 时间:2023-10-24 16:39
declare @i int
set @i=1
declare @Total bigint
set @Total=1
declare @Sum int
set @Sum=0
while(@i<=20)
begin
if @i%2=0 set @Total=@Total*@i
else set @Sum=@Sum+@i
set @i=@i+1
end
print 'Total='+cast(@Total as varchar)
print 'Sum='+cast(@Sum as varchar)
结果如下:
Total=37151200
Sum=100
热心网友 时间:2023-10-24 16:39
declare @i int
set @i=1
declare @Total bigint
set @Total=1
declare @Sum int
set @Sum=0
while(@i<=20)
begin
if @i%2=0 set @Total=@Total*@i
else set @Sum=@Sum+@i
set @i=@i+1
end
print 'Total='+cast(@Total as varchar)
print 'Sum='+cast(@Sum as varchar)
结果如下:
Total=37151200
Sum=100
热心网友 时间:2023-10-24 16:40
忘了。。。也木有时间
热心网友 时间:2023-10-24 16:39
declare @i int
set @i=1
declare @Total bigint
set @Total=1
declare @Sum int
set @Sum=0
while(@i<=20)
begin
if @i%2=0 set @Total=@Total*@i
else set @Sum=@Sum+@i
set @i=@i+1
end
print 'Total='+cast(@Total as varchar)
print 'Sum='+cast(@Sum as varchar)
结果如下:
Total=37151200
Sum=100
热心网友 时间:2023-10-24 16:40
忘了。。。也木有时间
热心网友 时间:2023-10-24 16:40
忘了。。。也木有时间
热心网友 时间:2023-10-24 16:39
declare @i int
set @i=1
declare @Total bigint
set @Total=1
declare @Sum int
set @Sum=0
while(@i<=20)
begin
if @i%2=0 set @Total=@Total*@i
else set @Sum=@Sum+@i
set @i=@i+1
end
print 'Total='+cast(@Total as varchar)
print 'Sum='+cast(@Sum as varchar)
结果如下:
Total=37151200
Sum=100
热心网友 时间:2023-10-24 16:40
忘了。。。也木有时间