Off[General::spell1]; 
Clear[Romberg,f0,a,b,M];
Romberg[f0_,a_, b_,M_] :=
Module[{f, h, n, m,i},
  Set@@{f[x_],f0};
  r = Table[0,{i,1,M+1},{j,1,M+1}];
  h= b - a; 
  r[[1,1]]= N[h*(f[a] + f[b])/2,digit]; 
  For[n=1, n<=M, n++,
    h = h /2;
    r[[n+1,1]] = N[r[[n ,1]] /2 + 
       h * Sum[f[a+(2i-1)h],{i,1,
       2^(n-1)}],digit];
    For[m=1, m <=n, m++,
       r[[n+1,m+1 ]]= N[r[[n+1,m]]+ 
        (r[[n+1,m]]-r[[n,m]])/(4^m-1),
        digit];];  
   Print["n=",n, "    ", r[[n,n]]];
   ]; 
 Print[ MatrixForm[r]  ];];
On[General::spell1];

Clear[digit];
digit=16;

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

Romberg[f[x],0,1, 10]

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

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

Simplify[f''[x] ]

Romberg[f[x],0,1, 10]

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