作业帮 > 综合 > 作业

VF程序判断十个整数是否素数

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/11/08 21:31:29
VF程序判断十个整数是否素数
CLOSE ALL
CLEAR ALL
CLEAR
nEndNo = 10
FOR nLoop_01 = 1 TO nEndNo
cLoop_01 = PADL(ALLTRIM(STR(nLoop_01)),2," ")
DO WHILE .T.
INPUT "请输入第&cLoop_01.个数据:" TO nGetNo
IF NOT TYPE([nGetNo]) = "N"
"数据无效!"
ELSE
IF nGetNo > 0 AND INT(nGetNo) = nGetNo
cPrimeChkFlag = "Prime"
IF nGetNo > 3
FOR nLoop_02 = 2 TO nGetNo - 1
IF INT(nGetNo / nLoop_02) = nGetNo / nLoop_02
cPrimeChkFlag = "Composite"
EXIT
ENDIF
NEXT
ENDIF
IF cPrimeChkFlag = "Prime"
nGetNo,"是个素数."
ELSE
nGetNo,"是个复数."
ENDIF
EXIT
ENDIF
ENDIF
ENDDO
NEXT