Off[General::spell1];
Clear[TrapezRule,f0,a,b,n];
TrapezRule[f0_,a_,b_,n_] :=
Module[{f,k},
  Set@@{f[x_],f0};
  h = N[(b - a)/n,digit];
  x0 = N[a,digit];
  s = 0;
  For[k=1,k<=n-1,k++,
    Module[{},
      xk = x0 + h k;
      s = N[s + f[xk],digit]; ]];
  s = N[h ( f[a] + f[b] )/2 + h s,
    digit];
  Trule = s;
  Print[" "];
  Print["n=",n,"    T[n]=", N[Trule,digit]]; ];
On[General::spell1];

Clear[digit];
digit = 16;

Clear[f,x];
f[x_] = Exp[-x^2];

For[n = 10, n <= 20, n++, 
TrapezRule[f[x],0,1, n] ]

norm[f'']=Abs[f''[0]]

Clear[n];
Error[n_] = N[ 1 /(6 n^2),digit]

Error[20]

NIntegrate[f[x],{x,0,1}]

Clear[f,x];
f[x_] = Sin[ Sqrt[x] ];

Simplify[f''[x] ]

For[n = 30, n <= 40, n++,
TrapezRule[f[x],0,1, n] ]

N[NIntegrate[f[x],{x,0,1}], digit]