IF INT(n/2)=n/2 MESSAGEBOX('你输入的不是奇数,请重输!',48,'系统提醒:') RETURN ENDIF sn=0 FOR i=1 to n step 2 sn=sn+i ENDFOR
*-*命令按钮下代码 NUM=0 THISFORM.LABEL1.CAPTION=[奇数和:] FOR I=VAL(THISFORM.TEXT1.VALUE) TO VAL(THISFORM.TEXT2.VALUE) NUM=NUM+IIF(I%2=0,0,I) ENDFOR THISFORM.LABEL1.CAPTION=THISFORM.LABEL1.CAPTION+TRANSFORM(NUM) *-*表单CLICK事件 THISFORM.RELEASE
n=thisform.text1.value IF INT(n/2)=n/2 MESSAGEBOX("你输入的不是奇数,请重输!") RETURN ENDIF sn=0 FOR i=1 to n step 2 sn=sn+i thisform.text2.value=sn ENDFOR 谢谢了!