连加,可以计算正整数从x到y的连加。
mfp吧
全部回复
仅看楼主
level 12
喂wswswsws 楼主
function lj()
variable a,a1,a2,b,c,t,t2,d
a=input("起点:")
c=input("终点:")
d=a-1
t=now()
if tools::even_number(a)
a1=(d+1)*(d/2)
else
a1=(d+1)*((d-1)/2)+(d+1)/2
endif
if tools::even_number(c)
a2=(c+1)*(c/2)
else
a2=(c+1)*((c-1)/2)+(c+1)/2
endif
print(+a2-a1+"\n")
t2=now()
print(t2-t+"ms"+"\n")
return (lj())
endf
2017年07月09日 09点07分 1
level 12
喂wswswsws 楼主
2017年07月09日 09点07分 2

2017年07月10日 22点07分
1