! Compute the value of pi by numeric integration
program pi_ex
   implicit none
   integer n, i
   double precision h, pi
   parameter (n=80000000)
   h = 1.0 / n

   pi = 0.0
   do i=1, n
      pi = pi + h * (4 / (1.0  +  h*(i-0.5) * h*(i-0.5)))
   end do
   
   write(*,*) pi
end 
