主题:此程序为什么无法运行啊
我是新手 课程设计要用到
program zaft
integer:: M=0,L=0
real R,S,P,S0,x,y
real,external::ran0
write(*,*)"输入运行次数N(如1000000)"
read(*,*)N
write(*,*)"输入半径R="
read(*,*)R
do while(M>=N)
M=M+1
x=ran0(M)*R
y=ran0(M+1)*R
if(x*x+y*y<=R*R)then
L=L+1
end if
end do
P=L/N
S=4*R*R*P
write(*,*)"S="
write(*,*) S
S0=3.1415926*R*R
write(*,*)"实际的面积S0="
write(*,*)S0
stop
end
FUNCTION ran0(idum)
INTEGER idum,IA,IM,IQ,IR,MASK
REAL ran0,AM
PARAMETER(IA=16807,IM=2147483647,AM=1./IM,IQ=127773,IR=2836,MASK=123459876)
INTEGER k
idum=ieor(idum,MASK)
k=idum/IQ
idum=IA*(idum-k*IQ)-IR*k
if(idum<0)idum=idum+IM
ran0=AM*idum
idum=ieor(idum,MASK)
END FUNCTION ran0[em18][em18][em18]
program zaft
integer:: M=0,L=0
real R,S,P,S0,x,y
real,external::ran0
write(*,*)"输入运行次数N(如1000000)"
read(*,*)N
write(*,*)"输入半径R="
read(*,*)R
do while(M>=N)
M=M+1
x=ran0(M)*R
y=ran0(M+1)*R
if(x*x+y*y<=R*R)then
L=L+1
end if
end do
P=L/N
S=4*R*R*P
write(*,*)"S="
write(*,*) S
S0=3.1415926*R*R
write(*,*)"实际的面积S0="
write(*,*)S0
stop
end
FUNCTION ran0(idum)
INTEGER idum,IA,IM,IQ,IR,MASK
REAL ran0,AM
PARAMETER(IA=16807,IM=2147483647,AM=1./IM,IQ=127773,IR=2836,MASK=123459876)
INTEGER k
idum=ieor(idum,MASK)
k=idum/IQ
idum=IA*(idum-k*IQ)-IR*k
if(idum<0)idum=idum+IM
ran0=AM*idum
idum=ieor(idum,MASK)
END FUNCTION ran0[em18][em18][em18]