포트란, 면적구하기, 수치해석, trapezoid equation
Channel: Fortran Tutorial
Date: 2022-02-05

#포트란 #수치해석 #trapezoid_equation

      program trapezoid_rule
      real x,s,func
      integer i
      func(x)=1.0/(1.0+x*x)
      s=(func(0.0)+func(1.0))*0.5
      do i=1,9
        s=s+func(real(i)/10.0)
      enddo
      print *, '     pi/4        pi'
      write(*,20) 0.1*s,0.4*s
20    format(2f10.5)
      endprogram trapezoid_rule