program calc
  use integral, only: trapezoid
  integer :: n, ios
  real    :: a, b
  namelist /nml/ a, b, n
  write(*,*) ' Input interval (a,b) and division number (n) like'
  write(*,*) '   "&nml a=0, b=10, n=100 /"'
  read(*, nml, iostat = ios)
  if ( ios == 0 ) then
    s = trapezoid(a,b,n)
    write(*,*) s
  else
    write(*,*) '  Error: input data is invalid.' ; stop
  end if
end program calc
