module my_type INTEGER, PARAMETER :: IB = SELECTED_INT_KIND(9) !integer*4 INTEGER, PARAMETER :: SP = SELECTED_REAL_KIND(6,37) !real*4 !INTEGER, PARAMETER :: DP = SELECTED_REAL_KIND(15,307) !real*8 end module my_type program circle use my_type implicit none integer(ib) :: seed real(sp) :: vol,x1,y1,ran1 real(sp) :: summ,var integer(ib) :: n,i seed=5 print*,'give in number of points' read*,n vol=1._sp summ=0._sp do i=1,n x1=ran1(seed) y1=ran1(seed) if(x1**2+y1**2 .le. 1._sp) then summ=summ+1._sp var=var+1._sp endif enddo print*,i summ=summ*vol/n var=vol*sqrt(((var/n)-(summ/n)**2)/n) print*,4.*summ,' +/- ',4.*var end function ran1(seed) use my_type implicit none integer(ib), parameter :: m=2147483647,a=69621,q=30845, r=23902 real(sp), parameter :: m1=1._sp/m integer(ib) :: k,seed real(sp) :: ran1 k=seed/q seed=a*(seed-k*q)-r*k if(seed.lt.0) seed =seed+m ran1=float(seed)*m1 return end