用“蒙特卡洛”法求π值 Author: 四川省通江县中学高九四级六班 张渝 Date: 1992-10-02 10 INPUT “模拟次数”,CS 20 T=0 30 FOR I=1 TO CS 40 X=RND(1)*6:M=X+0.5:N=X-0.5 50 FOR J=1 TO 5 STEP 2 60 IF M>J AND N<J THEN T=T+1 70 NEXT J,I 80 PI=CS/T:PRINT "P1=";PI 90 END