declare @i int,@Jsum int,@Osum intset @i=1set @Jsum=0set @Osum=0while(@i<=100)begin if(@i%2=0) set @Osum=@osum+@i else set @Jsum=@Jsum+@iset @i=@i+1endselect @Jsum as '奇数和',@Osum as '偶数和' 得出结果奇数和:2500 偶数和:2550