我想编写:输入一个整数,输出它的质因素,并将他们累加起来(例如120的质因素为2、2、2、3、5)。
do while .t.
n=0
@ 2,2 get n picture '999'
read
if n<1
exit
endif
_sum=0
for i=2 to n
if n%i=0
? i
_sum=_sum+1
n=n/i
endif
endfor
? 'sum=',_sum
enddo
...全文
403打赏收藏
急(在线等待)
我想编写:输入一个整数,输出它的质因素,并将他们累加起来(例如120的质因素为2、2、2、3、5)。 do while .t. n=0 @ 2,2 get n picture '999' read if n<1 exit endif _sum=0 for i=2 to n if n%i=0 ? i _sum=_sum+1 n=n/i endif endfor ? 'sum=',_sum enddo