CLEAR
STORE [] TO LC奇,LC偶
FOR I=1 TO 100
IF MOD(I,2)=1
LC奇=LC奇+TRANSFORM(I)+IIF(I<99,[+],[])
ELSE
LC偶=LC偶+TRANSFORM(I)+IIF(I<100,[+],[])
ENDIF
ENDFOR
?[奇数=]+LC奇+[(之和=]+TRANSFORM(&LC奇)+[)]
?[偶数=]+LC偶+[(之和=]+TRANSFORM(&LC偶)+[)]
Clear All
Clear
LOCAL i
i=1
Sumz=0
oddsum=0&&&奇数和
evensum=0&&&偶数和
Do While i<=100
Sumz=Sumz+i
If Mod(i,2)=1
oddsum=oddsum+i
Else
evensum=evensum+i
Endif
i=i+1
Enddo
?"1到100的和:",Sumz
?"其中奇数的和:",oddsum
?"其中偶数的和:",evensum